[PATCH v12 2/3] vpci/msi: Implement cleanup function for MSI

2025-09-26 Thread Jiqian Chen
ce cleanup function of MSI is implemented, delete the open-code in vpci_deassign_device(). Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v11->v12 changes: * In cleanup_msi(), move "if ( !hide )" above vpci_remove_registers() since deassign device will do

[PATCH v12 0/3] Support hiding capability when its initialization fails

2025-09-26 Thread Jiqian Chen
. Best regards, Jiqian Chen. --- cc: "Roger Pau Monné" --- Jiqian Chen (3): vpci/rebar: Implement cleanup function for Rebar vpci/msi: Implement cleanup function for MSI vpci/msix: Implement cleanup function for MSI-X xen/drivers/vpci/msi.c | 55 ++

[PATCH v12 1/3] vpci/rebar: Implement cleanup function for Rebar

2025-09-26 Thread Jiqian Chen
Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v11->v12 changes: * In cleanup_rebar(), move the check "if ( !hide )" above the vpci_remove_registers(). * In init_rebar(), change return rc to continue when "if ( index >= PCI_HEADER_NORMAL_NR_BARS )&qu

[PATCH v11 0/5] Support hiding capability when its initialization fails

2025-08-08 Thread Jiqian Chen
regards, Jiqian Chen. --- cc: "Roger Pau Monné" cc: Anthony PERARD --- Jiqian Chen (5): vpci: Use cleanup to free capability resource during deassign vpci: Refactor vpci_remove_register to remove matched registers vpci/rebar: Implement cleanup function for Rebar vpci/msi: Impleme

[PATCH v11 3/5] vpci/rebar: Implement cleanup function for Rebar

2025-08-08 Thread Jiqian Chen
Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v10->v11 changes: * Add ASSERT_UNREACHABLE() when vpci_remove_registers() fails * When hide == true, add handlers to let Rebar ctrl be RO. * Remove Roger's Reviewed-by since patch change. v9->v10 changes: v8->v9 c

[PATCH v11 1/5] vpci: Use cleanup to free capability resource during deassign

2025-08-08 Thread Jiqian Chen
vpci_init_capabilities() require different cleanup actions, add a boolean parameter to cleanup hook to distinguish them. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v10->v11 changes: new patch. --- xen/drivers/vpci/vpci.c | 25 - xen/include/xen/vpci.h |

[PATCH v11 5/5] vpci/msix: Implement cleanup function for MSI-X

2025-08-08 Thread Jiqian Chen
ls. Since cleanup function of MSI-X is implemented, delete the open-code in vpci_deassign_device(). Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v10->v11 changes: * Move calling all cleanup hook in vpci_deassign_device() out of this patch. * Add hide parameter to cleanup_msix

[PATCH v11 4/5] vpci/msi: Implement cleanup function for MSI

2025-08-08 Thread Jiqian Chen
ce cleanup function of MSI is implemented, delete the open-code in vpci_deassign_device(). Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v10->v11 changes: * Add hide paratemer to cleanup_msi(). * Check hide, if false return directly instead of letting ctrl RO. * Delete xfr

[PATCH v11 2/5] vpci: Refactor vpci_remove_register to remove matched registers

2025-08-08 Thread Jiqian Chen
. Note: two test cases don't math the new logic of vpci_remove_registers(), then modify them. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" cc: Anthony PERARD --- v10->v11 changes: No. v9->v10 changes: * Since logic change of vpci_remove_registers() affect the test c

[PATCH v10 3/4] vpci/msi: Free MSI resources when init_msi() fails

2025-08-04 Thread Jiqian Chen
ed in cleanup function of MSI. To do that, implement cleanup function for MSI. Signed-off-by: Jiqian Chen Reviewed-by: Roger Pau Monné --- cc: "Roger Pau Monné" --- v9->v10 changes: No. v8->v9 changes: * Add Roger's Reviewed-by. v7->v8 changes: * Add a comment to des

[PATCH v10 1/4] vpci: Refactor vpci_remove_register to remove matched registers

2025-08-04 Thread Jiqian Chen
. Note: two test cases don't math the new logic of vpci_remove_registers(), then modify them. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" cc: Anthony PERARD --- v9->v10 changes: * Since logic change of vpci_remove_registers() affect the test cases of tools/tests/vpci/m

[PATCH v10 4/4] vpci/msix: Free MSIX resources when init_msix() fails

2025-08-04 Thread Jiqian Chen
a. As all supported capabilities have been switched to use the cleanup hooks call those from vpci_deassign_device() instead of open-code the capability specific cleanup in there. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v9->v10 changes: * Call all cleanup hook in vpci_de

[PATCH v10 2/4] vpci/rebar: Free Rebar resources when init_rebar() fails

2025-08-04 Thread Jiqian Chen
moved in cleanup function of Rebar. To do that, implement cleanup function for Rebar. Signed-off-by: Jiqian Chen Reviewed-by: Roger Pau Monné --- cc: "Roger Pau Monné" --- v9->v10 changes: v8->v9 changes: No. v7->v8 changes: * Add Roger's Reviewed-by. v6->v7 changes

[PATCH v10 0/4] Support hiding capability when its initialization fails

2025-08-04 Thread Jiqian Chen
, Jiqian Chen. --- cc: "Roger Pau Monné" cc: Anthony PERARD --- Jiqian Chen (4): vpci: Refactor vpci_remove_register to remove matched registers vpci/rebar: Free Rebar resources when init_rebar() fails vpci/msi: Free MSI resources when init_msi() fails vpci/msix: Free MSIX reso

[PATCH v9 1/8] vpci/header: Emulate extended capability list for dom0

2025-07-27 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen Reviewed-by: Jan Beulich Reviewed-by: Roger Pau Monné --- cc: "Roger Pau Monné" --- v8->v9 changes: * Add Jan and Roger's Reviewed-by. v7->v8 changes: * Remove the unnecessary function vpci_hw_write32, since it can cause the value of the exten

[PATCH v9 6/8] vpci/rebar: Free Rebar resources when init_rebar() fails

2025-07-27 Thread Jiqian Chen
moved in cleanup function of Rebar. To do that, implement cleanup function for Rebar. Signed-off-by: Jiqian Chen Reviewed-by: Roger Pau Monné --- cc: "Roger Pau Monné" --- v8->v9 changes: No. v7->v8 changes: * Add Roger's Reviewed-by. v6->v7 changes: * Change the point

[PATCH v9 2/8] vpci: Refactor REGISTER_VPCI_INIT

2025-07-27 Thread Jiqian Chen
this change, even if it's still unused. Further changes will make use of it. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: Stefano Stabellini --- v8->v9 changes: *

[PATCH v9 7/8] vpci/msi: Free MSI resources when init_msi() fails

2025-07-27 Thread Jiqian Chen
ed in cleanup function of MSI. To do that, implement cleanup function for MSI. Signed-off-by: Jiqian Chen Reviewed-by: Roger Pau Monné --- cc: "Roger Pau Monné" --- v8->v9 changes: * Add Roger's Reviewed-by. v7->v8 changes: * Add a comment to describe why "-2" i

[PATCH v9 8/8] vpci/msix: Free MSIX resources when init_msix() fails

2025-07-27 Thread Jiqian Chen
a. As all supported capabilities have been switched to use the cleanup hooks call those from vpci_deassign_device() instead of open-code the capability specific cleanup in there. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v8->v9 changes: * Modify commit message. *

[PATCH v9 5/8] vpci: Refactor vpci_remove_register to remove matched registers

2025-07-27 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen Reviewed-by: Roger Pau Monné --- cc: "Roger Pau Monné" cc: Anthony PERARD --- v8->v9 changes: v7->v8 changes: v6->v7 changes: No. v5->v6 changes: * Modify commit message. * Add Roger's Reviewed-by. v4->v5 changes: No. v3->v4 change

[PATCH v9 3/8] vpci: Hide legacy capability when it fails to initialize

2025-07-27 Thread Jiqian Chen
. So, add new function to hide legacy capability when initialization fails. And remove the failed legacy capability from the vpci emulated legacy capability list. Signed-off-by: Jiqian Chen Reviewed-by: Roger Pau Monné --- cc: "Roger Pau Monné" --- v8->v9 changes: * Add Roger'

[PATCH v9 4/8] vpci: Hide extended capability when it fails to initialize

2025-07-27 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen Reviewed-by: Roger Pau Monné --- cc: "Roger Pau Monné" cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: Stefano Stabellini --- v8->v9 changes: No v7->v8 changes: * s/and force/hopefully forcing/ in vpci_ext

[PATCH v9 0/8] Support hiding capability when its initialization fails

2025-07-27 Thread Jiqian Chen
. Best regards, Jiqian Chen. --- cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: "Roger Pau Monné" cc: Stefano Stabellini --- Jiqian Chen (8): vpci/header: Emulate extended capability list for dom0 vpci: Refactor REGISTER_VPCI_INIT

[PATCH 10/11] xen/platform_op: Wrap around XENPF_core_parking

2025-07-24 Thread Jiqian Chen
core_parking_helper() and get_cur_idle_nums() are only used for XENPF_core_parking, so wrap them. Signed-off-by: Jiqian Chen --- cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: "Roger Pau Monné" cc: Stefano Stabellini ---

[PATCH 11/11] xen/platform_op: Wrap around platform_op hypercall

2025-07-24 Thread Jiqian Chen
"# CONFIG_PLATFORM_OP is not set" in preset configs for PV shim on x86. With that, all dependent option get covered and could be deleted. Signed-off-by: Jiqian Chen --- cc: Stefano Stabellini cc: Julien Grall cc: Bertrand Marquis cc: Michal Orzel cc: Volodymyr Babchuk cc: Andrew

[PATCH 09/11] xen/platform_op: Wrap around XENPF_mem_hotadd

2025-07-24 Thread Jiqian Chen
alloc_hotadd_mfn share_hotadd_m2p_table transfer_pages_to_heap destroy_m2p_mapping destroy_compat_m2p_mapping cleanup_frame_table hotadd_mem_valid Signed-off-by: Jiqian Chen --- cc: Jan Beulich cc: Andrew Cooper cc: "Roger Pau

[PATCH 08/11] xen/xsm: Wrap around xsm_resource_(un)plug_core

2025-07-24 Thread Jiqian Chen
Since xsm_resource_plug_core and xsm_resource_unplug_core are only used for arch/x86/platform_hypercall.c and arch/sysctl.c, so wrap around them with CONFIG_SYSCTL and CONFIG_PLATFORM_OP. Signed-off-by: Jiqian Chen --- cc: "Daniel P. Smith" --- xen/include/xsm/xsm.h | 8 +++

[PATCH 04/11] xen/platform_op: Wrap around XENPF_firmware_info

2025-07-24 Thread Jiqian Chen
efi_get_info() is only used for XEN_FW_EFI_INFO of XENPF_firmware_info, so wrap it. And wrap its compat function efi_compat_get_info(). Signed-off-by: Jiqian Chen --- cc: "Daniel P. Smith" cc: "Marek Marczykowski-Górecki" cc: Jan Beulich --- xen/common/efi/common-stub.c

[PATCH 07/11] xen/platform_op: Wrap around XENPF_set_processor_pminfo

2025-07-24 Thread Jiqian Chen
compat_set_px_pminfo and compat_set_cx_pminfo related functions, also wrap them. Signed-off-by: Jiqian Chen --- cc: Jan Beulich cc: Andrew Cooper cc: "Roger Pau Monné" --- xen/arch/x86/acpi/cpu_idle.c| 6 ++ xen/arch/x86/acpi/cpufreq/cpufreq.c | 2 ++ xen/arch/x86/

[PATCH 00/11] Introduce CONFIG_PLATFORM_OP to disable platform_op hypercalls

2025-07-24 Thread Jiqian Chen
; cc: Anthony PERARD cc: Michal Orzel cc: Julien Grall cc: Stefano Stabellini cc: Lukasz Hawrylko cc: "Daniel P. Smith" cc: "Mateusz Mówka" cc: Dario Faggioli cc: Juergen Gross cc: George Dunlap cc: "Marek Marczykowski-Górecki" cc: Bertrand Marquis cc: Vo

[PATCH 02/11] xen/xsm: Wrap around xsm_platform_op with CONFIG_PLATFORM_OP

2025-07-24 Thread Jiqian Chen
As function xsm_platform_op() is solely invoked in platform_hypercall.c, it needs to be wrapped around with CONFIG_PLATFORM_OP. Signed-off-by: Jiqian Chen --- cc: "Daniel P. Smith" --- xen/include/xsm/xsm.h | 4 xen/xsm/dummy.c | 3 +++ xen/xsm/flask/hooks.c | 5

[PATCH 06/11] xen/platform_op: Wrap around XENPF_enter_acpi_sleep

2025-07-24 Thread Jiqian Chen
serial_resume console_giveback tboot_s3_resume tboot_s3_error acpi_sleep_post enable_nonboot_cpus thaw_domains Signed-off-by: Jiqian Chen

[PATCH 05/11] xen/platform_op: Wrap around XENPF_efi_runtime_call

2025-07-24 Thread Jiqian Chen
efi_runtime_call() is only used for XENPF_efi_runtime_call, wrap it and its compat function and its calling functions: efi_compat_runtime_call() gwstrlen() cast_time() cast_guid() Signed-off-by: Jiqian Chen --- cc: "Daniel P. Smith" cc: "Marek Marczykowski-Górecki" cc: J

[PATCH 03/11] xen/platform_op: Wrap around XENPF_microcode_update(2)

2025-07-24 Thread Jiqian Chen
wait_for_condition wait_cpu_callin wait_cpu_callout primary_thread_fn secondary_thread_fn Signed-off-by: Jiqian Chen --- cc: Jan Beulich cc: Andrew Cooper

[PATCH 01/11] xen: Introduce CONFIG_PLATFORM_OP

2025-07-24 Thread Jiqian Chen
the final patch. Signed-off-by: Jiqian Chen --- cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: "Roger Pau Monné" cc: Stefano Stabellini --- xen/common/Kconfig | 4 1 file changed, 4 insertions(+) diff --git a/xen/common/Kconfig

[PATCH v8 7/8] vpci/msi: Free MSI resources when init_msi() fails

2025-07-23 Thread Jiqian Chen
ed in cleanup function of MSI. To do that, implement cleanup function for MSI. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v7->v8 changes: * Add a comment to describe why "-2" in cleanup_msi(). * Given the code in vpci_remove_registers() an error in the removal

[PATCH v8 0/8] Support hiding capability when its initialization fails

2025-07-23 Thread Jiqian Chen
. Best regards, Jiqian Chen. --- cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: "Roger Pau Monné" cc: Stefano Stabellini --- Jiqian Chen (8): vpci/header: Emulate extended capability list for dom0 vpci: Refactor REGISTER_VPCI_INIT

[PATCH v8 5/8] vpci: Refactor vpci_remove_register to remove matched registers

2025-07-23 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen Reviewed-by: Roger Pau Monné --- cc: "Roger Pau Monné" cc: Anthony PERARD --- v7->v8 changes: v6->v7 changes: No. v5->v6 changes: * Modify commit message. * Add Roger's Reviewed-by. v4->v5 changes: No. v3->v4 changes: * Use list_

[PATCH v8 2/8] vpci: Refactor REGISTER_VPCI_INIT

2025-07-23 Thread Jiqian Chen
this change, even if it's still unused. Further changes will make use of it. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: Stefano Stabellini --- v7->v8 changes: * Recover vp

[PATCH v8 6/8] vpci/rebar: Free Rebar resources when init_rebar() fails

2025-07-23 Thread Jiqian Chen
moved in cleanup function of Rebar. To do that, implement cleanup function for Rebar. Signed-off-by: Jiqian Chen Reviewed-by: Roger Pau Monné --- cc: "Roger Pau Monné" --- v7->v8 changes: * Add Roger's Reviewed-by. v6->v7 changes: * Change the pointer parameter of c

[PATCH v8 8/8] vpci/msix: Free MSIX resources when init_msix() fails

2025-07-23 Thread Jiqian Chen
ed in cleanup function of MSIX. To do that, implement cleanup function for MSIX. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v7->v8 changes: * Given the code in vpci_remove_registers() an error in the removal of registers would likely imply memory corruption, at which

[PATCH v8 4/8] vpci: Hide extended capability when it fails to initialize

2025-07-23 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen Reviewed-by: Roger Pau Monné --- cc: "Roger Pau Monné" cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: Stefano Stabellini --- v7->v8 changes: * s/and force/hopefully forcing/ in vpci_ext_capability_hide().

[PATCH v8 1/8] vpci/header: Emulate extended capability list for dom0

2025-07-23 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v7->v8 changes: * Remove the unnecessary function vpci_hw_write32, since it can cause the value of the extended capability header cached in vPCI of dom0 is inconsistent with the hardware. v6->v7 changes: * Change word &quo

[PATCH v8 3/8] vpci: Hide legacy capability when it fails to initialize

2025-07-23 Thread Jiqian Chen
. So, add new function to hide legacy capability when initialization fails. And remove the failed legacy capability from the vpci emulated legacy capability list. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v7->v8 changes: * Change the type of next from uint31_t to un

[PATCH v7 5/8] vpci: Refactor vpci_remove_register to remove matched registers

2025-07-04 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen Reviewed-by: Roger Pau Monné --- cc: "Roger Pau Monné" cc: Anthony PERARD --- v6->v7 changes: No. v5->v6 changes: * Modify commit message. * Add Roger's Reviewed-by. v4->v5 changes: No. v3->v4 changes: * Use list_for_each_entry_safe ins

[PATCH v7 2/8] vpci: Refactor REGISTER_VPCI_INIT

2025-07-04 Thread Jiqian Chen
vpci_make_msix_hole() in modify_decoding() since it is not needed. The cleanup hook is also added in this change, even if it's still unused. Further changes will make use of it. Signed-off-by: Jiqian Chen --- There is a byte alignment problem in the array __start_vpci_array, which can be solved after &qu

[PATCH v7 8/8] vpci/msix: Free MSIX resources when init_msix() fails

2025-07-04 Thread Jiqian Chen
ed in cleanup function of MSIX. To do that, implement cleanup function for MSIX. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v6->v7 changes: * Change the pointer parameter of cleanup_msix() to be const. * When vpci_remove_registers() in cleanup_msix() fails, not to

[PATCH v7 0/8] Support hiding capability when its initialization fails

2025-07-04 Thread Jiqian Chen
. Best regards, Jiqian Chen. --- cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: "Roger Pau Monné" cc: Stefano Stabellini --- Jiqian Chen (8): vpci/header: Emulate extended capability list for dom0 vpci: Refactor REGISTER_VPCI_INIT

[PATCH v7 4/8] vpci: Hide extended capability when it fails to initialize

2025-07-04 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen --- Comment left over for the situation that "capability in 0x100 can't be removed case" from Jan in last version, need Roger's input. Jan: Can we rely on OSes recognizing ID 0 as "just skip"? Since the size isn't encoded in the header,

[PATCH v7 7/8] vpci/msi: Free MSI resources when init_msi() fails

2025-07-04 Thread Jiqian Chen
ed in cleanup function of MSI. To do that, implement cleanup function for MSI. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v6->v7 changes: * Change the pointer parameter of cleanup_msi() to be const. * When vpci_remove_registers() in cleanup_msi() fails, not to return

[PATCH v7 6/8] vpci/rebar: Free Rebar resources when init_rebar() fails

2025-07-04 Thread Jiqian Chen
moved in cleanup function of Rebar. To do that, implement cleanup function for Rebar. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v6->v7 changes: * Change the pointer parameter of cleanup_rebar() to be const. * Print error when vpci_remove_registers() fail in cleanu

[PATCH v7 3/8] vpci: Hide legacy capability when it fails to initialize

2025-07-04 Thread Jiqian Chen
. So, add new function to hide legacy capability when initialization fails. And remove the failed legacy capability from the vpci emulated legacy capability list. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v6->v7 changes: * Change the pointer parameter of vpci

[PATCH v7 1/8] vpci/header: Emulate extended capability list for dom0

2025-07-04 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v6->v7 changes: * Change word "guest" to "DomU" in vpci_init_ext_capability_list(). * Change parameter of vpci_init_ext_capability_list() to be const. * Delete check "if ( !header )" in the while loop of

[PATCH v6 1/8] vpci/header: Emulate extended capability list for dom0

2025-06-12 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v5->v6 changes: * Delete unnecessary parameter "ttl" in vpci_init_ext_capability_list() since vpci_add_register() can already detect the overlaps. v4->v5 changes: * Add check: if capability list of hardware has a

[PATCH v6 5/8] vpci: Refactor vpci_remove_register to remove matched registers

2025-06-12 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen Reviewed-by: Roger Pau Monné --- cc: "Roger Pau Monné" cc: Anthony PERARD --- v5->v6 changes: * Modify commit message. * Add Roger's Reviewed-by. v4->v5 changes: No. v3->v4 changes: * Use list_for_each_entry_safe instead of list_for_each_e

[PATCH v6 6/8] vpci/rebar: Free Rebar resources when init_rebar() fails

2025-06-12 Thread Jiqian Chen
moved in cleanup function of Rebar. To do that, implement cleanup function for Rebar. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v5->v6 changes: No. v4->v5 changes: * Change definition "static void cleanup_rebar" to "static int cf_check cleanup_reb

[PATCH v6 00/8] Support hiding capability when its initialization fails

2025-06-12 Thread Jiqian Chen
. Best regards, Jiqian Chen. --- cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: "Roger Pau Monné" cc: Stefano Stabellini --- Jiqian Chen (8): vpci/header: Emulate extended capability list for dom0 vpci: Refactor REGISTER_VPCI_INIT

[PATCH v6 2/8] vpci: Refactor REGISTER_VPCI_INIT

2025-06-12 Thread Jiqian Chen
this change, even if it's still unused. Further changes will make use of it. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: Stefano Stabellini --- v5->v6 c

[PATCH v6 3/8] vpci: Hide legacy capability when it fails to initialize

2025-06-12 Thread Jiqian Chen
. So, add new function to hide legacy capability when initialization fails. And remove the failed legacy capability from the vpci emulated legacy capability list. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v5->v6 changes: * Rename parameter rm to r in vpci_get_register

[PATCH v6 8/8] vpci/msix: Free MSIX resources when init_msix() fails

2025-06-12 Thread Jiqian Chen
ed in cleanup function of MSIX. To do that, implement cleanup function for MSIX. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v5->v6 changes: * Change the logic to add dummy handler when !vpci->msix in cleanup_msix(). v4->v5 changes: * Change definition "

[PATCH v6 7/8] vpci/msi: Free MSI resources when init_msi() fails

2025-06-12 Thread Jiqian Chen
ed in cleanup function of MSI. To do that, implement cleanup function for MSI. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v5->v6 changes: No. v4->v5 changes: * Change definition "static void cleanup_msi" to "static int cf_check cleanup_msi" since

[PATCH v6 4/8] vpci: Hide extended capability when it fails to initialize

2025-06-12 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: Stefano Stabellini --- v5->v6 changes: * Change to use for loop to compact code of vpci_get_previous_ext_cap_register(). * Rename paramet

[PATCH v5 02/10] vpci/header: Emulate legacy capability list for dom0

2025-05-26 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v4->v5 changes: * Return early if dom0, so that I didn't need to change the exiting return chunk. v3->v4 changes: * Also pass supported_caps to pci_find_next_cap_ttl() for dom0 since the n is zero when dom0,

[PATCH v5 09/10] vpci/msi: Free MSI resources when init_msi() fails

2025-05-26 Thread Jiqian Chen
ed in cleanup function of MSI. To do that, implement cleanup function for MSI. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v4->v5 changes: * Change definition "static void cleanup_msi" to "static int cf_check cleanup_msi" since cleanup hook is changed

[PATCH v5 03/10] vpci/header: Emulate extended capability list for dom0

2025-05-26 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v4->v5 changes: * Add check: if capability list of hardware has a overlap, print warning and return 0. v3->v4 changes: * Add check "if ( !header ) return 0;" to avoid adding handler for device that has no exte

[PATCH v5 05/10] vpci: Hide legacy capability when it fails to initialize

2025-05-26 Thread Jiqian Chen
. So, add new function to hide legacy capability when initialization fails. And remove the failed legacy capability from the vpci emulated legacy capability list. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v4->v5 changes: * Modify vpci_get_register() to delete some unne

[PATCH v5 10/10] vpci/msix: Free MSIX resources when init_msix() fails

2025-05-26 Thread Jiqian Chen
ed in cleanup function of MSIX. To do that, implement cleanup function for MSIX. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v4->v5 changes: * Change definition "static void cleanup_msix" to "static int cf_check cleanup_msix" since cleanup hook i

[PATCH v5 08/10] vpci/rebar: Free Rebar resources when init_rebar() fails

2025-05-26 Thread Jiqian Chen
moved in cleanup function of Rebar. To do that, implement cleanup function for Rebar. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v4->v5 changes: * Change definition "static void cleanup_rebar" to "static int cf_check cleanup_rebar" since clea

[PATCH v5 04/10] vpci: Refactor REGISTER_VPCI_INIT

2025-05-26 Thread Jiqian Chen
hange, even if it's still unused. Further changes will make use of it. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: Stefano Stabellini --- v4->v5 changes: * Rename REGISTER_

[PATCH v5 01/10] vpci/header: Move emulating cap list logic into new function

2025-05-26 Thread Jiqian Chen
No functional changes. Follow-on changes will benifit from this. Signed-off-by: Jiqian Chen Acked-by: Roger Pau Monné --- cc: "Roger Pau Monné" --- v4->v5 changes: No. v3->v4 changes: * Add Acked-by of Roger. v2->v3 changes: new patch. Best regards, Jiqian Chen. --

[PATCH v5 07/10] vpci: Refactor vpci_remove_register to remove matched registers

2025-05-26 Thread Jiqian Chen
prefix. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" cc: Anthony PERARD --- v4->v5 changes: No. v3->v4 changes: * Use list_for_each_entry_safe instead of list_for_each_entry. * Return ERANGE if overlap. v2->v3 changes: * Add new check to return error if registers ove

[PATCH v5 06/10] vpci: Hide extended capability when it fails to initialize

2025-05-26 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: Stefano Stabellini --- v4->v5 changes: * Modify the hex digits of PCI_EXT_CAP_NEXT_MASK and PCI_EXT_CAP_NEXT to be low c

[PATCH v5 00/10] Support hiding capability when its initialization fails

2025-05-26 Thread Jiqian Chen
patch #7, #8, #9, #10. Best regards, Jiqian Chen. --- cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: "Roger Pau Monné" cc: Stefano Stabellini --- Jiqian Chen (10): vpci/header: Move emulating cap list logic into new function v

[PATCH v4 05/10] vpci: Hide legacy capability when it fails to initialize

2025-05-09 Thread Jiqian Chen
. So, add new function to hide legacy capability when initialization fails. And remove the failed legacy capability from the vpci emulated legacy capability list. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v3->v4 changes: * Modify the commit message.

[PATCH v4 08/10] vpci/rebar: Remove registers when init_rebar() fails

2025-05-09 Thread Jiqian Chen
sible registered registers. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v3->v4 changes: * Change function name from fini_rebar() to cleanup_rebar(). * Change the error number to be E2BIG and ENXIO in init_rebar(). v2->v3 changes: * Use fini_rebar() to remove all regis

[PATCH v4 10/10] vpci/msix: Add function to clean MSIX resources

2025-05-09 Thread Jiqian Chen
When init_msix() fails, it needs to clean all MSIX resources. So, add a new function to do that. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v3->v4 changes: * Change function name from fini_msix() to cleanup_msix(). * Change to use XFREE to free vpci->msix. * In

[PATCH v4 09/10] vpci/msi: Free MSI resources when init_msi() fails

2025-05-09 Thread Jiqian Chen
calculating the size of msi registers. v1->v2 changes: * Added a new function fini_msi to free all MSI resources instead of using an array to record registered registers. Best regards, Jiqian Chen. --- xen/drivers/vpci/msi.c | 22 +- 1 file changed, 21 insertions(+), 1 de

[PATCH v4 07/10] vpci: Refactor vpci_remove_register to remove matched registers

2025-05-09 Thread Jiqian Chen
prefix. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" cc: Anthony PERARD --- v3->v4 changes: * Use list_for_each_entry_safe instead of list_for_each_entry. * Return ERANGE if overlap. v2->v3 changes: * Add new check to return error if registers overlap but not inside range.

[PATCH v4 02/10] vpci/header: Emulate legacy capability list for dom0

2025-05-09 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v3->v4 changes: * Also pass supported_caps to pci_find_next_cap_ttl() for dom0 since the n is zero when dom0, and add a comment to explain it. * Restrict adding PCI_STATUS register only for domU since dom0 has no limitat

[PATCH v4 04/10] vpci: Refactor REGISTER_VPCI_INIT

2025-05-09 Thread Jiqian Chen
hange, even if it's still unused. Further changes will make use of it. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: Stefano Stabellini --- v3->v4 changes * Delete the useless

[PATCH v4 01/10] vpci/header: Move emulating cap list logic into new function

2025-05-09 Thread Jiqian Chen
No functional changes. Follow-on changes will benifit from this. Signed-off-by: Jiqian Chen Acked-by: Roger Pau Monné --- cc: "Roger Pau Monné" --- v3->v4 changes: * Add Acked-by of Roger. v2->v3 changes: new patch. Best regards, Jiqian Chen. --- xen/drivers/vpc

[PATCH v4 03/10] vpci/header: Emulate extended capability list for dom0

2025-05-09 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v3->v4 changes: * Add check "if ( !header ) return 0;" to avoid adding handler for device that has no extended capabilities. v2->v3 changes: * In vpci_init_ext_capability_list(), when domain is domU, directly retu

[PATCH v4 06/10] vpci: Hide extended capability when it fails to initialize

2025-05-09 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v3->v4 changes: * Change definition of PCI_EXT_CAP_NEXT to be "#define PCI_EXT_CAP_NEXT(header) (MASK_EXTR(header, PCI_EXT_CAP_NEXT_MASK) & 0xFFCU)" to avoid redundancy. * Modify the commit message. * Change vpci_ext_

[PATCH v4 00/10] Support hiding capability when its initialization fails

2025-05-09 Thread Jiqian Chen
patch #7, #8, #9, #10. Best regards, Jiqian Chen. --- cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: "Roger Pau Monné" cc: Stefano Stabellini --- Jiqian Chen (10): vpci/header: Move emulating cap list logic into new function v

[PATCH v3 05/11] vpci: Refactor REGISTER_VPCI_INIT

2025-04-20 Thread Jiqian Chen
nfig space. Note: Call vpci_make_msix_hole() in the end of init_msix() since the change of sequence of init_header() and init_msix(). The fini hook will be implemented in follow-on changes. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" cc: Andrew Cooper cc: Anthony PERARD cc: M

[PATCH v3 08/11] vpci: Refactor vpci_remove_register to remove matched registers

2025-04-20 Thread Jiqian Chen
to remove a non exist register, so remove the __must_check prefix. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" cc: Anthony PERARD --- v2->v3 changes: * Add new check to return error if registers overlap but not inside range. v1->v2 changes: new patch Best rega

[PATCH v3 09/11] vpci/rebar: Remove registers when init_rebar() fails

2025-04-20 Thread Jiqian Chen
sters. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v2->v3 changes: * Use fini_rebar() to remove all register instead of in the failure path of init_rebar(); v1->v2 changes: * Called vpci_remove_registers() to remove all possible registered registers instead of using

[PATCH v3 03/11] vpci/header: Emulate legacy capability list for dom0

2025-04-20 Thread Jiqian Chen
Current logic of emulating legacy capability list is only for domU. So, expand it to emulate for dom0 too. Then it will be easy to hide a capability whose initialization fails in a function. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v2->v3 changes: * Not to a

[PATCH v3 07/11] vpci: Hide extended capability when it fails to initialize

2025-04-20 Thread Jiqian Chen
handler from vpci extended capability list. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v2->v3 changes: * Separated from the last version patch "vpci: Hide capability when it fails to initialize". * Whole implementation changed because last version is wro

[PATCH v3 06/11] vpci: Hide legacy capability when it fails to initialize

2025-04-20 Thread Jiqian Chen
emulated legacy capability list. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v2->v3 changes: * Separated from the last version patch "vpci: Hide capability when it fails to initialize" * Whole implementation changed because last version is wrong. This ve

[PATCH v3 02/11] driver/pci: Get next capability without passing caps

2025-04-20 Thread Jiqian Chen
Modify function pci_find_next_cap_ttl to support returning position of next capability when size "n" is zero. That can help caller to get next capability offset if caller just has a information of current capability offset. That will be used in a follow-on change. Signed-off-by: J

[PATCH v3 04/11] vpci/header: Emulate extended capability list for dom0

2025-04-20 Thread Jiqian Chen
. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v2->v3 changes: * In vpci_init_ext_capability_list(), when domain is domU, directly return after adding a handler(hiding all extended capability for domU). * In vpci_init_ext_capability_list(), change condition to be "whil

[PATCH v3 11/11] vpci/msix: Add function to clean MSIX resources

2025-04-20 Thread Jiqian Chen
When init_msix() fails, it needs to clean all MSIX resources. So, add a new function to do that. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v2->v3 changes: * Remove unnecessary clean operations in fini_msix(). v1->v2 changes: new patch. Best regards, Jiqia

[PATCH v3 00/11] Support hiding capability when its initialization fails

2025-04-20 Thread Jiqian Chen
, including patch #8, #9, #10, #11. Best regards, Jiqian Chen. --- cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: "Roger Pau Monné" cc: Stefano Stabellini --- Jiqian Chen (11): vpci/header: Move emulating cap list logic into new function

[PATCH v3 10/11] vpci/msi: Free MSI resources when init_msi() fails

2025-04-20 Thread Jiqian Chen
ff-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v2->v3 changes: * Remove all fail path, and use fini_msi() hook instead. * Change the method to calculating the size of msi registers. v1->v2 changes: * Added a new function fini_msi to free all MSI resources instead of using an array

[PATCH v3 01/11] vpci/header: Move emulating cap list logic into new function

2025-04-20 Thread Jiqian Chen
No functional changes. Follow-on changes will benifit from this. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné" --- v2->v3 changes: new patch. Best regards, Jiqian Chen. --- xen/drivers/vpci/header.c | 138 -- 1 file changed, 73 inse

[PATCH v2 3/8] vpci/header: Emulate extended capability list for host

2025-04-10 Thread Jiqian Chen
Add a new function to emulate extended capability list for host, and call it in init_header(). So that, it will be easy to hide a capability whose initialization fails. As for the extended capability list of guest, keep hiding it. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné"

[PATCH v2 8/8] vpci/msix: Add function to clean MSIX resources

2025-04-09 Thread Jiqian Chen
When init_msix() fails, it needs to clean all MSIX resources. So, add a new function fini_msix() to do that. And to unregister the mmio handler of vpci_msix_table_ops, add a new function. Signed-off-by: Jiqian Chen --- cc: Jan Beulich cc: Andrew Cooper cc: "Roger Pau Monné"

[PATCH v2 2/8] vpci/header: Emulate legacy capability list for host

2025-04-09 Thread Jiqian Chen
Current logic of init_header() only emulates legacy capability list for guest, expand it to emulate for host too. So that it will be easy to hide a capability whose initialization fails and no need to distinguish host or guest. Signed-off-by: Jiqian Chen --- cc: "Roger Pau Monné"

[PATCH v2 1/8] driver/pci: Get next capability without passing caps

2025-04-09 Thread Jiqian Chen
n a follow-on change. Signed-off-by: Jiqian Chen --- cc: Andrew Cooper cc: Anthony PERARD cc: Michal Orzel cc: Jan Beulich cc: Julien Grall cc: "Roger Pau Monné" cc: Stefano Stabellini --- v1->v2 changes: new patch Best regards, Jiqian Chen. --- xen/drivers/pci/pci.c | 6 +- xen/

  1   2   3   >