[QEMU PATCH v10] xen/passthrough: use gsi to map pirq when dom0 is PVH

2024-11-05 Thread Jiqian Chen
To solve above problem, use new interface of Xen, xc_pcidev_get_gsi to get gsi and use xc_physdev_map_pirq_gsi to map pirq when dom0 is PVH. Signed-off-by: Jiqian Chen Signed-off-by: Huang Rui Signed-off-by: Jiqian Chen --- Hi All, This is v10 to support passthrough on Xen when dom0 is PVH.

[QEMU PATCH v9] xen/passthrough: use gsi to map pirq when dom0 is PVH

2024-10-24 Thread Jiqian Chen
To solve above problem, use new interface of Xen, xc_pcidev_get_gsi to get gsi and use xc_physdev_map_pirq_gsi to map pirq when dom0 is PVH. Signed-off-by: Jiqian Chen Signed-off-by: Huang Rui Signed-off-by: Jiqian Chen --- Hi All, This is v9 to support passthrough on Xen when dom0 is PVH. v8-

[QEMU PATCH v8] xen/passthrough: use gsi to map pirq when dom0 is PVH

2024-10-15 Thread Jiqian Chen
To solve above problem, use new interface of Xen, xc_pcidev_get_gsi to get gsi and use xc_physdev_map_pirq_gsi to map pirq when dom0 is PVH. Signed-off-by: Jiqian Chen Signed-off-by: Huang Rui Signed-off-by: Jiqian Chen --- Hi All, This is v8 to support passthrough on Xen when dom0 is PVH. v7-

[PATCH v11 2/2] virtio-pci: implement No_Soft_Reset bit

2024-06-06 Thread Jiqian Chen
then guest can check this bit, if this bit is set, the devices resetting will not be done, and then the display can work after resuming. No_Soft_Reset bit is implemented for all virtio devices, and was tested only on virtio-gpu device. Set it false by default for safety. Signed-off-by: Jiqian

[PATCH v11 0/2] S3 support

2024-06-06 Thread Jiqian Chen
Hi all, This is the v11 patch to support S3. v11 makes below changes: * patch#1 no changes. * patch#2 add "x-" prefix to pcie-pm-no-soft-reset and add old machine compability. Best regards, Jiqian Chen v10 makes below changes: * patch#1 change the description of commit message. *

[PATCH v11 1/2] virtio-pci: only reset pm state during resetting

2024-06-06 Thread Jiqian Chen
of PM_CTRL is writable. Only when flag VIRTIO_PCI_FLAG_INIT_PM is set, need to reset state. Fixes: 27ce0f3afc9dd ("fix Power Management Control Register for PCI Express virtio devices" Signed-off-by: Jiqian Chen --- hw/virtio/virtio-pci.c | 8 +++- 1 file changed, 7 insertions(+),

[RFC QEMU PATCH v7 0/1] Support device passthrough when dom0 is PVH on Xen

2024-05-16 Thread Jiqian Chen
Hi All, This is v7 series to support passthrough on Xen when dom0 is PVH. v6->v7 changes: * Due to changes in the implementation of obtaining gsi in the kernel and Xen. Change to use xc_physdev_gsi_from_dev, that requires passing in sbdf instead of irq. Best regards, Jiqian Chen v5-

[RFC QEMU PATCH v7 1/1] xen/pci: get gsi for passthrough devices

2024-05-16 Thread Jiqian Chen
ion supported by Xen tools. Signed-off-by: Huang Rui Signed-off-by: Jiqian Chen --- hw/xen/xen-host-pci-device.c | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/hw/xen/xen-host-pci-device.c b/hw/xen/xen-host-pci-device.c index 8c6e9a1716a2..2fe6a60434ba 100644 --

[PATCH v10 2/2] virtio-pci: implement No_Soft_Reset bit

2024-05-15 Thread Jiqian Chen
then guest can check this bit, if this bit is set, the devices resetting will not be done, and then the display can work after resuming. No_Soft_Reset bit is implemented for all virtio devices, and was tested only on virtio-gpu device. Set it false by default for safety. Signed-off-by: Jiqian

[PATCH v10 1/2] virtio-pci: only reset pm state during resetting

2024-05-15 Thread Jiqian Chen
of PM_CTRL is writable. Only when flag VIRTIO_PCI_FLAG_INIT_PM is set, need to reset state. Fixes: 27ce0f3afc9dd ("fix Power Management Control Register for PCI Express virtio devices" Signed-off-by: Jiqian Chen --- hw/virtio/virtio-pci.c | 8 +++- 1 file changed, 7 insertions(+),

[PATCH v10 0/2] S3 support

2024-05-15 Thread Jiqian Chen
Hi all, This is the v10 patch to support S3. v10 makes below changes: * patch#1 change the description of commit message. * patch#2 no changes. Best regards, Jiqian Chen v9 makes below changes: * patch#1 no changes * patch#2 remove unnecessary parentheses. add some comments to

[RFC QEMU PATCH v6 0/1] Support device passthrough when dom0 is PVH on Xen

2024-04-18 Thread Jiqian Chen
Hi All, This is v6 series to support passthrough on Xen when dom0 is PVH. v5->v6 changes: * Due to changes in the implementation of obtaining gsi in the kernel and Xen. Change to use xc_physdev_gsi_from_irq, instead of gsi sysfs. Best regards, Jiqian Chen v4->v5 changes: * Add rev

[RFC QEMU PATCH v6 1/1] xen/pci: get gsi from irq for passthrough devices

2024-04-18 Thread Jiqian Chen
new function supported by Xen tools. Signed-off-by: Huang Rui Signed-off-by: Jiqian Chen --- hw/xen/xen-host-pci-device.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/xen/xen-host-pci-device.c b/hw/xen/xen-host-pci-device.c index 8c6e9a1716a2..5e9aa9679e3e 100644 --- a

[RFC QEMU PATCH v9 1/2] virtio-pci: only reset pm state during resetting

2024-04-16 Thread Jiqian Chen
Fix bug imported by 27ce0f3afc9dd25d21b43bbce505157afd93d111 (fix Power Management Control Register for PCI Express virtio devices) Only state of PM_CTRL is writable. Only when flag VIRTIO_PCI_FLAG_INIT_PM is set, need to reset state. Signed-off-by: Jiqian Chen --- hw/virtio/virtio-pci.c | 8

[RFC QEMU PATCH v9 2/2] virtio-pci: implement No_Soft_Reset bit

2024-04-16 Thread Jiqian Chen
then guest can check this bit, if this bit is set, the devices resetting will not be done, and then the display can work after resuming. No_Soft_Reset bit is implemented for all virtio devices, and was tested only on virtio-gpu device. Set it false by default for safety. Signed-off-by: Jiqian

[RFC QEMU PATCH v9 0/1] S3 support

2024-04-16 Thread Jiqian Chen
. keep No_Soft_Reset bit false by default for safety. Best regards, Jiqian Chen v8 makes below changes: * Add a new patch#1 to fix a problem import by 27ce0f3afc9dd25d21b43bbce505157afd93d111, the right action is that only the state of PM_CTRL can be clear when resetting. * patch#2 is

[RFC QEMU PATCH v8 1/2] virtio-pci: only reset pm state during resetting

2024-03-28 Thread Jiqian Chen
Fix bug imported by 27ce0f3afc9dd25d21b43bbce505157afd93d111 (fix Power Management Control Register for PCI Express virtio devices) Only state of PM_CTRL is writable. Only when flag VIRTIO_PCI_FLAG_INIT_PM is set, need to reset state. Signed-off-by: Jiqian Chen --- hw/virtio/virtio-pci.c | 8

[RFC QEMU PATCH v8 2/2] virtio-pci: implement No_Soft_Reset bit

2024-03-28 Thread Jiqian Chen
then guest can check this bit, if this bit is set, the devices resetting will not be done, and then the display can work after resuming. Signed-off-by: Jiqian Chen --- hw/virtio/virtio-pci.c | 29 + include/hw/virtio/virtio-pci.h | 5 + 2 files change

[RFC QEMU PATCH v8 0/1] S3 support

2024-03-28 Thread Jiqian Chen
No_Soft_Reset bit, and in this version, I rename function and change some condition sequence. Best regards, Jiqian Chen v7 makes below changes: * Tested this patch with Qemu on Xen hypervisor. Depending on kernel patch (virtio: Add support for no-reset virtio PCI PM: https://lore.kernel.org/lkml

[QEMU PATCH v5 0/1] Support device passthrough when dom0 is PVH on Xen

2024-03-27 Thread Jiqian Chen
o get gsi. Then xc_physdev_map_pirq() will success. This v2 on qemu side is the same as the v1 (qemu https://lore.kernel.org/xen-devel/20230312092244.451465-19-ray.hu...@amd.com/), just call xc_physdev_gsi_from_irq() to get gsi from irq. Jiqian Chen (1): xen: Use gsi instead of irq for map

[RFC QEMU PATCH v5 1/1] xen: Use gsi instead of irq for mapping pirq

2024-03-27 Thread Jiqian Chen
use gsi number that read from gsi sysfs if it exists. Signed-off-by: Huang Rui Signed-off-by: Jiqian Chen Reviewed-by: Stefano Stabellini --- RFC: discussions ongoing on the Linux side where/how to expose the gsi --- hw/xen/xen-host-pci-device.c | 7 +++ hw/xen/xen-host-pci-device.h | 1 +

[RFC QEMU PATCH v7 1/1] virtio-pci: implement No_Soft_Reset bit

2024-03-25 Thread Jiqian Chen
then guest can check this bit, if this bit is set, the devices resetting will not be done, and then the display can work after resuming. Signed-off-by: Jiqian Chen --- hw/virtio/virtio-pci.c | 38 +- include/hw/virtio/virtio-pci.h | 5 + 2 files ch

[RFC QEMU PATCH v7 0/1] S3 support

2024-03-25 Thread Jiqian Chen
value of flag VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET_BIT to false * Fixed coding style violation * Modified the content of the comments. * Removed useless flag PCI_PM_CTRL_DATA_SCALE_MASK. Best regards, Jiqian Chen V6: In current code, when guest does S3, virtio devices are reset during that process

[QEMU PATCH v6 0/1] S3 support

2024-02-21 Thread Jiqian Chen
-spec. (https://lists.oasis-open.org/archives/virtio-comment/202401/msg00077.html) Best regards, Jiqian Chen V5: Hi all, v5 makes below changes: * Since this series patches add a new mechanism that let virtgpu and Qemu can negotiate their reset behavior, and other guys hope me can improve

[QEMU PATCH v6 1/1] virtio-pci: implement No_Soft_Reset bit

2024-02-21 Thread Jiqian Chen
then guest can check this bit, if this bit is set, the devices resetting will not be done, and then the display can work after resuming. Signed-off-by: Jiqian Chen --- hw/virtio/virtio-pci.c | 37 +- include/hw/virtio/virtio-pci.h | 5 + 2 files ch

[RFC QEMU PATCH v4 1/1] xen: Use gsi instead of irq for mapping pirq

2024-01-04 Thread Jiqian Chen
use gsi number that read from gsi sysfs if it exists. Co-developed-by: Huang Rui Signed-off-by: Jiqian Chen --- hw/xen/xen-host-pci-device.c | 7 +++ hw/xen/xen-host-pci-device.h | 1 + hw/xen/xen_pt.c | 6 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/hw/

[RFC QEMU PATCH v4 0/1] Support device passthrough when dom0 is PVH on Xen

2024-01-04 Thread Jiqian Chen
uccess. This v2 on qemu side is the same as the v1 ( qemu https://lore.kernel.org/xen-devel/20230312092244.451465-19-ray.hu...@amd.com/), just call xc_physdev_gsi_from_irq() to get gsi from irq. Jiqian Chen (1): xen: Use gsi instead of irq for mapping pirq hw/xen/xen-host-pci-device

[RFC QEMU PATCH v3 0/1] Support device passthrough when dom0 is PVH on Xen

2023-12-10 Thread Jiqian Chen
ide: https://lore.kernel.org/xen-devel/20231124104136.3263722-1-jiqian.c...@amd.com/T/#t Jiqian Chen (1): xen: Use gsi instead of irq for mapping pirq hw/xen/xen-host-pci-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.34.1

[RFC QEMU PATCH v3 1/1] xen: Use gsi instead of irq for mapping pirq

2023-12-10 Thread Jiqian Chen
gsi sysfs. Co-developed-by: Huang Rui Signed-off-by: Jiqian Chen --- hw/xen/xen-host-pci-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xen/xen-host-pci-device.c b/hw/xen/xen-host-pci-device.c index 8c6e9a1716..e270ac2631 100644 --- a/hw/xen/xen-host-pci-device.c ++

[RFC QEMU PATCH v2 0/1] Support device passthrough when dom0 is PVH on Xen

2023-11-24 Thread Jiqian Chen
xc_physdev_gsi_from_irq() to get gsi from irq. v2 on kernel side: https://lore.kernel.org/lkml/20231124103123.3263471-1-jiqian.c...@amd.com/T/#t v2 on Xen side: https://lore.kernel.org/xen-devel/20231124104136.3263722-1-jiqian.c...@amd.com/T/#t Jiqian Chen (1): xen/pci: get gsi from irq for passthrough

[RFC QEMU PATCH v2 1/1] xen/pci: get gsi from irq for passthrough devices

2023-11-24 Thread Jiqian Chen
in current code, that is irq not gsi, so it will fail when mapping. For above reason, on Xen side, we add a new function to translate irq to gsi. And at here, we call that function to get the correct gsi number. Signed-off-by: Jiqian Chen Signed-off-by: Huang Rui --- hw/xen/xen-host-pci-devic

[VIRTIO PCI PATCH v5 1/1] transport-pci: Add freeze_mode to virtio_pci_common_cfg

2023-09-19 Thread Jiqian Chen
o devices to affect the behavior of Qemu, not just virtio gpu device. Signed-off-by: Jiqian Chen --- transport-pci.tex | 7 +++ 1 file changed, 7 insertions(+) diff --git a/transport-pci.tex b/transport-pci.tex index a5c6719..2543536 100644 --- a/transport-pci.tex +++ b/transport-p

[VIRTIO PCI PATCH v5 0/1] Add freeze_mode to virtio_pci_common_cfg

2023-09-19 Thread Jiqian Chen
to trace this issue: https://gitlab.com/qemu-project/qemu/-/issues/1860 Best regards, Jiqian Chen v4: no v4 patches. V4 of Qemu patch: https://lore.kernel.org/qemu-devel/20230719074726.1613088-1-jiqian.c...@amd.com/T/#t No v4 of kernel patch v3: makes below changes: * Use enum for freeze mode, so

[QEMU PATCH v5 1/2] virtio-pci: Add freeze_mode case for virtio pci

2023-09-19 Thread Jiqian Chen
freeze_mode to be FREEZE_S3, so that virtio devices can change their reset behavior on Qemu side according to that mode. Signed-off-by: Jiqian Chen --- hw/virtio/virtio-pci.c | 5 + hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 2 ++ 3 files changed, 8 insertions(+) diff

[QEMU PATCH v5 2/2] virtgpu: do not destroy resources when guest does S3

2023-09-19 Thread Jiqian Chen
splay. As a result, guest's screen can't come back to the time when it was suspended. So when freeze_mode is set FREEZE_S3 by guest, we can know that guest is doing S3, and we can prevent Qemu to destroy the resources. Signed-off-by: Jiqian Chen --- hw/display/virtio-gpu-gl.c | 9 ++

[QEMU PATCH v5 0/1] add freeze_mode for virtio-pci and support S3 for virtgpu

2023-09-19 Thread Jiqian Chen
ources, so that the display can come back after resuming. V5 of kernel patch: https://lore.kernel.org/lkml/20230919104607.2282248-1-jiqian.c...@amd.com/T/#t The link to trace this issue: https://gitlab.com/qemu-project/qemu/-/issues/1860 Best regards, Jiqian Chen v4: Hi all, Thanks for Gerd

[LINUX KERNEL PATCH v5 0/1] add freeze_mode for virtio_pci and add S3 support for virtgpu

2023-09-19 Thread Jiqian Chen
in restore(). The link to trace this issue: https://gitlab.com/qemu-project/qemu/-/issues/1860 Best regards, Jiqian Chen v4: Link: no v4 of kernel patch. V4 of Qemu patch: https://lore.kernel.org/qemu-devel/20230720120816.8751-1-jiqian.c...@amd.com/ v3: makes below changes: * Use enum for free

[LINUX KERNEL PATCH v5 1/2] virtio_pci: Add freeze_mode for virtio_pci_common_cfg

2023-09-19 Thread Jiqian Chen
set freeze_mode to be FREEZE_S3, so that virtio devices can change their reset behavior on Qemu side according to that mode. Signed-off-by: Jiqian Chen --- drivers/virtio/virtio.c| 13 + drivers/virtio/virtio_pci_modern.c | 9 + drivers/virtio/virtio_pci

[LINUX KERNEL PATCH v5 2/2] virtgpu: Add freeze and restore func to reinit vqs

2023-09-19 Thread Jiqian Chen
initializes virtqueues. And then, Qemu and guest can communicate normally. Signed-off-by: Jiqian Chen --- drivers/gpu/drm/virtio/virtgpu_drv.c | 23 + drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_kms.c | 30 +++- 3 files

[RESEND QEMU PATCH v4 0/1] S3 support

2023-09-11 Thread Jiqian Chen
Hi all, I hope you’ll forgive me if this disturb you. Since it has been almost two months since the latest patch was sent out, I didn't receive any reply, so I rebase the latest master branch and sent it again. I am looking forward to getting your response. Best regards, Jiqian Chen v4: H

[RESEND QEMU PATCH v4 1/1] virtgpu: do not destroy resources when guest suspend

2023-09-11 Thread Jiqian Chen
th guest, so it added a new feature flag VIRTIO_GPU_F_FREEZE_S3, so that guest and host can negotiate whenever freeze_S3 is supported or not. Signed-off-by: Jiqian Chen --- hw/display/virtio-gpu-base.c | 3 +++ hw/display/virtio-gpu-gl.c | 10 ++- hw/display/virtio-gpu-virgl.c | 7 ++

[RESEND VIRTIO GPU PATCH v3 1/1] virtio-gpu: Add new feature flag VIRTIO_GPU_F_FREEZE_S3

2023-09-11 Thread Jiqian Chen
guest and host can negotiate whenever freeze_S3 is supported or not. Signed-off-by: Jiqian Chen --- device-types/gpu/description.tex | 42 1 file changed, 42 insertions(+) diff --git a/device-types/gpu/description.tex b/device-types/gpu/description.tex index 4

[RESEND VIRTIO GPU PATCH v3 0/1] Add new feature flag VIRTIO_GPU_F_FREEZE_S3

2023-09-11 Thread Jiqian Chen
Hi all, I hope you’ll forgive me if this disturb you. Since it has been almost two months since the latest patch was sent out, I didn't receive any reply, so I rebase the latest master branch and sent it again. I am looking forward to getting your response. Best regards, Jiqian Chen v3: H

[RESEND LINUX KERNEL PATCH 0/1] add S3 support for virtgpu

2023-09-11 Thread Jiqian Chen
Hi all, I hope you’ll forgive me if this disturb you. Since it has been almost two months since the latest patch was sent out, I didn't receive any reply, so I rebase the latest master branch and sent it again. I am looking forward to getting your response. Best regards, Jiqian Chen v3: H

[RESEND LINUX KERNEL PATCH 1/1] virtgpu: init vq during resume and notify qemu guest status

2023-09-11 Thread Jiqian Chen
a new feature flag VIRTIO_GPU_F_FREEZE_S3, so that guest and host can negotiate whenever freeze_S3 is supported or not. Signed-off-by: Jiqian Chen --- drivers/gpu/drm/virtio/virtgpu_debugfs.c | 1 + drivers/gpu/drm/virtio/virtgpu_drv.c | 39 drivers/gpu/drm/virtio/vir

[QEMU PATCH v4 0/1] S3 support

2023-07-20 Thread Jiqian Chen
kernel.org/lkml/20230720115805.8206-1-jiqian.c...@amd.com/T/#t Best regards, Jiqian Chen. v3: link, https://lore.kernel.org/qemu-devel/20230719074726.1613088-1-jiqian.c...@amd.com/T/#t Hi all, Thanks for Michael S. Tsirkin's advice. V3 makes below changes: * Remove changes in file incl

[QEMU PATCH v4 1/1] virtgpu: do not destroy resources when guest suspend

2023-07-20 Thread Jiqian Chen
th guest, so it added a new feature flag VIRTIO_GPU_F_FREEZE_S3, so that guest and host can negotiate whenever freeze_S3 is supported or not. Signed-off-by: Jiqian Chen --- hw/display/virtio-gpu-base.c | 3 ++ hw/display/virtio-gpu-gl.c | 10 ++- hw/display/virtio-gpu-virgl.c | 7 ++

[QEMU PATCH v3 0/1] S3 support

2023-07-19 Thread Jiqian Chen
v3: Hi all, Thanks for Michael S. Tsirkin's advice. V3 makes below changes: * Remove changes in file include/standard-headers/linux/virtio_gpu.h I am not supposed to edit this file and it will be imported after the patches of linux kernel was merged. Best regards, Jiqian Chen. v2:

[QEMU PATCH v3 0/1] virtgpu: do not destroy resources when guest suspend

2023-07-19 Thread Jiqian Chen
, so it added a new feature flag VIRTIO_GPU_F_FREEZING, so that guest and host can negotiate whenever freezing is supported or not. Signed-off-by: Jiqian Chen --- hw/display/virtio-gpu-base.c | 3 ++ hw/display/virtio-gpu-gl.c | 9 +- hw/display/virtio-gpu-virgl.c | 7 + hw/displ

[QEMU PATCH v2 0/1] S3 support

2023-06-30 Thread Jiqian Chen
lso needs hot-plug support. * Add a new feature flag VIRTIO_GPU_F_FREEZING, so that guest and host can negotiate whenever freezing is supported or not. Best regards, Jiqian Chen. v1: link: https://lore.kernel.org/qemu-devel/20230608025655.1674357-1-jiqian.c...@amd.com/ Hi all, I am working

[QEMU PATCH v2 1/1] virtgpu: do not destroy resources when guest suspend

2023-06-30 Thread Jiqian Chen
, so it added a new feature flag VIRTIO_GPU_F_FREEZING, so that guest and host can negotiate whenever freezing is supported or not. Signed-off-by: Jiqian Chen --- hw/display/virtio-gpu-base.c| 3 ++ hw/display/virtio-gpu-gl.c | 9 +++- hw/display/vir

[QEMU PATCH 1/1] virtgpu: do not destroy resources when guest suspend

2023-06-07 Thread Jiqian Chen
is will prevent destroying resources and resetting renderer when guest calls into virtio_gpu_gl_reset. If guest is during resuming, it sets freezing to false, and then virtio_gpu_gl_reset will keep its origin actions and has no other impaction. Signed-off-by: Jiqian Chen --- hw/display/

[QEMU PATCH 0/1]

2023-06-07 Thread Jiqian Chen
that guest is suspending, it will not destroy resources and will not reset renderer. If freezing is set to false, Qemu will do its origin actions, and has no other impaction. And now, display can come back and applications can continue their status after guest resumes. Jiqian Chen (1): virtgpu: d