Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hypervisor/kvm: Fix serial device access for ARM #3300

Merged
merged 1 commit into from
Jun 28, 2023

Conversation

rene
Copy link
Contributor

@rene rene commented Jun 23, 2023

The QEMU's virt machine model (ARM64) doesn't support isa-serial emulation, so guests cannot access serial devices of the host. This commit fixes this issue changing emulation to pci-serial only for the virt machine model.

Error message from the logs:

2023-06-23T10:02:45Z,guest_vm_err-a9fcef42-11d9-4ce9-9a7b-5ead87abd6ad.1.1;qemu-system-aarch64:/run/domainmgr/xen/xen1.cfg:145: 'isa-serial' is not a valid device model name

@rene rene requested review from eriknordmark and rvs as code owners June 23, 2023 13:08
@rene rene force-pushed the fix-arm-serial branch from ce84d96 to 740e010 Compare June 23, 2023 13:20
@rouming
Copy link
Contributor

rouming commented Jun 23, 2023

Great, nobody did that on ARM :) Did you have a chance to test the attach of the serial port and reading/writing the data? Also would it make sense to change to the pci-serial on x86 as well?

@rouming
Copy link
Contributor

rouming commented Jun 23, 2023

BTW, there is eden test which covers serial attach: https://github.com/lf-edge/eden/blob/master/tests/eclient/testdata/com-pt_test.txt

Copy link
Contributor

@rouming rouming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack

@rene
Copy link
Contributor Author

rene commented Jun 23, 2023

Great, nobody did that on ARM :) Did you have a chance to test the attach of the serial port and reading/writing the data? Also would it make sense to change to the pci-serial on x86 as well?

@rouming, I think it does make sense to change pci-serial on x86 as well. However, I prefer to do it into a new PR since it can break VMs without support to serial over PCI, better test more before merge.

Let's keep only ARM changes here, since they are critical for now....

@rene rene force-pushed the fix-arm-serial branch from 740e010 to 8244e58 Compare June 23, 2023 14:35
Comment on lines 337 to 341
{{- if ne .Machine "virt"}}
backend = "tty"
{{- else}}
backend = "serial"
{{- end}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about having it without double negation?

Suggested change
{{- if ne .Machine "virt"}}
backend = "tty"
{{- else}}
backend = "serial"
{{- end}}
backend = "tty"
{{- if eq .Machine "virt"}}
backend = "serial"
{{- end}}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean like this?

{{- if eq .Machine "virt"}}
  backend = "serial"
{{- else}}
  backend = "tty"
{{- end}}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's also ok.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rene are you swapping the code per the above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes @eriknordmark , it's done.

Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kick off tests

The QEMU's virt machine model (ARM64) doesn't support isa-serial emulation,
so guests cannot access serial devices of the host. This commit fixes this
issue changing emulation to pci-serial only for the virt machine model.

Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
@rene rene force-pushed the fix-arm-serial branch from 8244e58 to 80669df Compare June 27, 2023 16:46
@rene
Copy link
Contributor Author

rene commented Jun 27, 2023

Updates in this PR:

Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eriknordmark eriknordmark merged commit 435b516 into lf-edge:master Jun 28, 2023
@rene rene deleted the fix-arm-serial branch November 2, 2023 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants