* [PATCH v4 00/10] hw/cxl: CXL emulation cleanups and minor fixes for upstream
@ 2023-02-06 17:28 Jonathan Cameron via
2023-02-06 17:28 ` [PATCH v4 01/10] hw/mem/cxl_type3: Improve error handling in realize() Jonathan Cameron via
` (9 more replies)
0 siblings, 10 replies; 21+ messages in thread
From: Jonathan Cameron via @ 2023-02-06 17:28 UTC (permalink / raw)
To: qemu-devel, Michael Tsirkin
Cc: Ben Widawsky, linux-cxl, linuxarm, Ira Weiny, Gregory Price,
Philippe Mathieu-Daudé
Since V3:
- Rebased on upstream today.
- Refreshed DSDT.cxl due to changes upstream.
- Picked up tags from Gregory.
A small collection of misc fixes and tidying up pulled out from various
series. I've pulled this to the top of my queue of CXL related work
as they stand fine on their own and it will reduce the noise in
the larger patch sets if these go upstream first.
Gregory's patches were posted as part of his work on adding volatile support.
https://lore.kernel.org/linux-cxl/20221006233702.18532-1-gregory.price@memverge.com/
https://lore.kernel.org/linux-cxl/20221128150157.97724-2-gregory.price@memverge.com/
I might propose this for upstream inclusion this cycle, but testing is
currently limited by lack of suitable kernel support.
Ira's patches were part of his event injection series.
https://lore.kernel.org/linux-cxl/20221221-ira-cxl-events-2022-11-17-v2-0-2ce2ecc06219@intel.com/
Intent is to propose for upstream the rest of that series shortly after
some minor changes from earlier review.
My five patches have not previously been posted before this series.
Baseline: 6661b8c7fe "Merge tag 'pull-ppc-20230205' of https://gitlab.com/danielhb/qemu into staging"
Gregory Price (2):
hw/cxl: set cxl-type3 device type to PCI_CLASS_MEMORY_CXL
hw/cxl: Add CXL_CAPACITY_MULTIPLIER definition
Ira Weiny (3):
qemu/bswap: Add const_le64()
qemu/uuid: Add UUID static initializer
hw/cxl/mailbox: Use new UUID network order define for cel_uuid
Jonathan Cameron (5):
hw/mem/cxl_type3: Improve error handling in realize()
hw/pci-bridge/cxl_downstream: Fix type naming mismatch
tests/acpi: Allow update of q35/DSDT.cxl
hw/i386/acpi: Drop duplicate _UID entry for CXL root bridge
tests: acpi: Update q35/DSDT.cxl for removed duplicate UID
hw/cxl/cxl-device-utils.c | 2 +-
hw/cxl/cxl-mailbox-utils.c | 28 +++++++++++++++-------------
hw/i386/acpi-build.c | 1 -
hw/mem/cxl_type3.c | 15 +++++++++++----
hw/pci-bridge/cxl_downstream.c | 2 +-
include/hw/cxl/cxl_device.h | 2 +-
include/qemu/bswap.h | 12 +++++++++++-
include/qemu/uuid.h | 12 ++++++++++++
tests/data/acpi/q35/DSDT.cxl | Bin 9578 -> 9564 bytes
9 files changed, 52 insertions(+), 22 deletions(-)
--
2.37.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v4 01/10] hw/mem/cxl_type3: Improve error handling in realize()
2023-02-06 17:28 [PATCH v4 00/10] hw/cxl: CXL emulation cleanups and minor fixes for upstream Jonathan Cameron via
@ 2023-02-06 17:28 ` Jonathan Cameron via
[not found] ` <CGME20230228041008uscas1p1296b02da63f7c8c81506d67dafe7ff75@uscas1p1.samsung.com>
2023-02-06 17:28 ` [PATCH v4 02/10] hw/pci-bridge/cxl_downstream: Fix type naming mismatch Jonathan Cameron via
` (8 subsequent siblings)
9 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron via @ 2023-02-06 17:28 UTC (permalink / raw)
To: qemu-devel, Michael Tsirkin
Cc: Ben Widawsky, linux-cxl, linuxarm, Ira Weiny, Gregory Price,
Philippe Mathieu-Daudé
msix_init_exclusive_bar() can fail, so if it does cleanup the address space.
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Gregory Price <gregory.price@memverge.com>
Tested-by: Gregory Price <gregory.price@memverge.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
hw/mem/cxl_type3.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c
index dae4fd89ca..252822bd82 100644
--- a/hw/mem/cxl_type3.c
+++ b/hw/mem/cxl_type3.c
@@ -401,7 +401,7 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp)
MemoryRegion *mr = ®s->component_registers;
uint8_t *pci_conf = pci_dev->config;
unsigned short msix_num = 1;
- int i;
+ int i, rc;
if (!cxl_setup_memory(ct3d, errp)) {
return;
@@ -438,7 +438,10 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp)
&ct3d->cxl_dstate.device_registers);
/* MSI(-X) Initailization */
- msix_init_exclusive_bar(pci_dev, msix_num, 4, NULL);
+ rc = msix_init_exclusive_bar(pci_dev, msix_num, 4, NULL);
+ if (rc) {
+ goto err_address_space_free;
+ }
for (i = 0; i < msix_num; i++) {
msix_vector_use(pci_dev, i);
}
@@ -450,6 +453,11 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp)
cxl_cstate->cdat.free_cdat_table = ct3_free_cdat_table;
cxl_cstate->cdat.private = ct3d;
cxl_doe_cdat_init(cxl_cstate, errp);
+ return;
+
+err_address_space_free:
+ address_space_destroy(&ct3d->hostmem_as);
+ return;
}
static void ct3_exit(PCIDevice *pci_dev)
--
2.37.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v4 02/10] hw/pci-bridge/cxl_downstream: Fix type naming mismatch
2023-02-06 17:28 [PATCH v4 00/10] hw/cxl: CXL emulation cleanups and minor fixes for upstream Jonathan Cameron via
2023-02-06 17:28 ` [PATCH v4 01/10] hw/mem/cxl_type3: Improve error handling in realize() Jonathan Cameron via
@ 2023-02-06 17:28 ` Jonathan Cameron via
[not found] ` <CGME20230228041044uscas1p1dfa4b92cb69b2f3c37d33c484521b491@uscas1p1.samsung.com>
2023-02-06 17:28 ` [PATCH v4 03/10] hw/cxl: set cxl-type3 device type to PCI_CLASS_MEMORY_CXL Jonathan Cameron via
` (7 subsequent siblings)
9 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron via @ 2023-02-06 17:28 UTC (permalink / raw)
To: qemu-devel, Michael Tsirkin
Cc: Ben Widawsky, linux-cxl, linuxarm, Ira Weiny, Gregory Price,
Philippe Mathieu-Daudé
Fix capitalization difference between struct name and typedef.
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Gregory Price <gregory.price@memverge.com>
Tested-by: Gregory Price <gregory.price@memverge.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
hw/pci-bridge/cxl_downstream.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/pci-bridge/cxl_downstream.c b/hw/pci-bridge/cxl_downstream.c
index 3d4e6b59cd..54f507318f 100644
--- a/hw/pci-bridge/cxl_downstream.c
+++ b/hw/pci-bridge/cxl_downstream.c
@@ -15,7 +15,7 @@
#include "hw/pci/pcie_port.h"
#include "qapi/error.h"
-typedef struct CXLDownStreamPort {
+typedef struct CXLDownstreamPort {
/*< private >*/
PCIESlot parent_obj;
--
2.37.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v4 03/10] hw/cxl: set cxl-type3 device type to PCI_CLASS_MEMORY_CXL
2023-02-06 17:28 [PATCH v4 00/10] hw/cxl: CXL emulation cleanups and minor fixes for upstream Jonathan Cameron via
2023-02-06 17:28 ` [PATCH v4 01/10] hw/mem/cxl_type3: Improve error handling in realize() Jonathan Cameron via
2023-02-06 17:28 ` [PATCH v4 02/10] hw/pci-bridge/cxl_downstream: Fix type naming mismatch Jonathan Cameron via
@ 2023-02-06 17:28 ` Jonathan Cameron via
[not found] ` <CGME20230228041113uscas1p1e62bf38766962db8de58b4c1b6cff804@uscas1p1.samsung.com>
2023-02-06 17:28 ` [PATCH v4 04/10] hw/cxl: Add CXL_CAPACITY_MULTIPLIER definition Jonathan Cameron via
` (6 subsequent siblings)
9 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron via @ 2023-02-06 17:28 UTC (permalink / raw)
To: qemu-devel, Michael Tsirkin
Cc: Ben Widawsky, linux-cxl, linuxarm, Ira Weiny, Gregory Price,
Philippe Mathieu-Daudé
From: Gregory Price <gourry.memverge@gmail.com>
Current code sets to STORAGE_EXPRESS and then overrides it.
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Gregory Price <gregory.price@memverge.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
hw/mem/cxl_type3.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c
index 252822bd82..217a5e639b 100644
--- a/hw/mem/cxl_type3.c
+++ b/hw/mem/cxl_type3.c
@@ -408,7 +408,6 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp)
}
pci_config_set_prog_interface(pci_conf, 0x10);
- pci_config_set_class(pci_conf, PCI_CLASS_MEMORY_CXL);
pcie_endpoint_cap_init(pci_dev, 0x80);
if (ct3d->sn != UI64_NULL) {
@@ -627,7 +626,7 @@ static void ct3_class_init(ObjectClass *oc, void *data)
pc->realize = ct3_realize;
pc->exit = ct3_exit;
- pc->class_id = PCI_CLASS_STORAGE_EXPRESS;
+ pc->class_id = PCI_CLASS_MEMORY_CXL;
pc->vendor_id = PCI_VENDOR_ID_INTEL;
pc->device_id = 0xd93; /* LVF for now */
pc->revision = 1;
--
2.37.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v4 04/10] hw/cxl: Add CXL_CAPACITY_MULTIPLIER definition
2023-02-06 17:28 [PATCH v4 00/10] hw/cxl: CXL emulation cleanups and minor fixes for upstream Jonathan Cameron via
` (2 preceding siblings ...)
2023-02-06 17:28 ` [PATCH v4 03/10] hw/cxl: set cxl-type3 device type to PCI_CLASS_MEMORY_CXL Jonathan Cameron via
@ 2023-02-06 17:28 ` Jonathan Cameron via
[not found] ` <CGME20230228041151uscas1p18d7918f0111d9186a6740c93293a7bc4@uscas1p1.samsung.com>
2023-02-06 17:28 ` [PATCH v4 05/10] tests/acpi: Allow update of q35/DSDT.cxl Jonathan Cameron via
` (5 subsequent siblings)
9 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron via @ 2023-02-06 17:28 UTC (permalink / raw)
To: qemu-devel, Michael Tsirkin
Cc: Ben Widawsky, linux-cxl, linuxarm, Ira Weiny, Gregory Price,
Philippe Mathieu-Daudé
From: Gregory Price <gourry.memverge@gmail.com>
Remove usage of magic numbers when accessing capacity fields and replace
with CXL_CAPACITY_MULTIPLIER, matching the kernel definition.
Signed-off-by: Gregory Price <gregory.price@memverge.com>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
v2:
Change to 256 * MiB and include qemu/units.h (Philippe Mathieu-Daudé)
---
hw/cxl/cxl-mailbox-utils.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c
index bc1bb18844..3f67b665f5 100644
--- a/hw/cxl/cxl-mailbox-utils.c
+++ b/hw/cxl/cxl-mailbox-utils.c
@@ -12,8 +12,11 @@
#include "hw/pci/pci.h"
#include "qemu/cutils.h"
#include "qemu/log.h"
+#include "qemu/units.h"
#include "qemu/uuid.h"
+#define CXL_CAPACITY_MULTIPLIER (256 * MiB)
+
/*
* How to add a new command, example. The command set FOO, with cmd BAR.
* 1. Add the command set and cmd to the enum.
@@ -138,7 +141,7 @@ static ret_code cmd_firmware_update_get_info(struct cxl_cmd *cmd,
} QEMU_PACKED *fw_info;
QEMU_BUILD_BUG_ON(sizeof(*fw_info) != 0x50);
- if (cxl_dstate->pmem_size < (256 << 20)) {
+ if (cxl_dstate->pmem_size < CXL_CAPACITY_MULTIPLIER) {
return CXL_MBOX_INTERNAL_ERROR;
}
@@ -283,7 +286,7 @@ static ret_code cmd_identify_memory_device(struct cxl_cmd *cmd,
CXLType3Class *cvc = CXL_TYPE3_GET_CLASS(ct3d);
uint64_t size = cxl_dstate->pmem_size;
- if (!QEMU_IS_ALIGNED(size, 256 << 20)) {
+ if (!QEMU_IS_ALIGNED(size, CXL_CAPACITY_MULTIPLIER)) {
return CXL_MBOX_INTERNAL_ERROR;
}
@@ -293,8 +296,8 @@ static ret_code cmd_identify_memory_device(struct cxl_cmd *cmd,
/* PMEM only */
snprintf(id->fw_revision, 0x10, "BWFW VERSION %02d", 0);
- id->total_capacity = size / (256 << 20);
- id->persistent_capacity = size / (256 << 20);
+ id->total_capacity = size / CXL_CAPACITY_MULTIPLIER;
+ id->persistent_capacity = size / CXL_CAPACITY_MULTIPLIER;
id->lsa_size = cvc->get_lsa_size(ct3d);
*len = sizeof(*id);
@@ -314,14 +317,14 @@ static ret_code cmd_ccls_get_partition_info(struct cxl_cmd *cmd,
QEMU_BUILD_BUG_ON(sizeof(*part_info) != 0x20);
uint64_t size = cxl_dstate->pmem_size;
- if (!QEMU_IS_ALIGNED(size, 256 << 20)) {
+ if (!QEMU_IS_ALIGNED(size, CXL_CAPACITY_MULTIPLIER)) {
return CXL_MBOX_INTERNAL_ERROR;
}
/* PMEM only */
part_info->active_vmem = 0;
part_info->next_vmem = 0;
- part_info->active_pmem = size / (256 << 20);
+ part_info->active_pmem = size / CXL_CAPACITY_MULTIPLIER;
part_info->next_pmem = 0;
*len = sizeof(*part_info);
--
2.37.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v4 05/10] tests/acpi: Allow update of q35/DSDT.cxl
2023-02-06 17:28 [PATCH v4 00/10] hw/cxl: CXL emulation cleanups and minor fixes for upstream Jonathan Cameron via
` (3 preceding siblings ...)
2023-02-06 17:28 ` [PATCH v4 04/10] hw/cxl: Add CXL_CAPACITY_MULTIPLIER definition Jonathan Cameron via
@ 2023-02-06 17:28 ` Jonathan Cameron via
[not found] ` <CGME20230228041219uscas1p140e49d902024e0eab1eb1cf3cba168fa@uscas1p1.samsung.com>
2023-02-06 17:28 ` [PATCH v4 06/10] hw/i386/acpi: Drop duplicate _UID entry for CXL root bridge Jonathan Cameron via
` (4 subsequent siblings)
9 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron via @ 2023-02-06 17:28 UTC (permalink / raw)
To: qemu-devel, Michael Tsirkin
Cc: Ben Widawsky, linux-cxl, linuxarm, Ira Weiny, Gregory Price,
Philippe Mathieu-Daudé
Next patch will drop duplicate _UID entry so allow update.
Reviewed-by: Gregory Price <gregory.price@memverge.com>
Tested-by: Gregory Price <gregory.price@memverge.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
tests/qtest/bios-tables-test-allowed-diff.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..9ce0f596cc 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,2 @@
/* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DSDT.cxl",
--
2.37.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v4 06/10] hw/i386/acpi: Drop duplicate _UID entry for CXL root bridge
2023-02-06 17:28 [PATCH v4 00/10] hw/cxl: CXL emulation cleanups and minor fixes for upstream Jonathan Cameron via
` (4 preceding siblings ...)
2023-02-06 17:28 ` [PATCH v4 05/10] tests/acpi: Allow update of q35/DSDT.cxl Jonathan Cameron via
@ 2023-02-06 17:28 ` Jonathan Cameron via
[not found] ` <CGME20230228041253uscas1p229d8375093fdd4d2de21be8921e35e32@uscas1p2.samsung.com>
2023-02-06 17:28 ` [PATCH v4 07/10] tests: acpi: Update q35/DSDT.cxl for removed duplicate UID Jonathan Cameron via
` (3 subsequent siblings)
9 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron via @ 2023-02-06 17:28 UTC (permalink / raw)
To: qemu-devel, Michael Tsirkin
Cc: Ben Widawsky, linux-cxl, linuxarm, Ira Weiny, Gregory Price,
Philippe Mathieu-Daudé
Noticed as this prevents iASL disasembling the DSDT table.
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Gregory Price <gregory.price@memverge.com>
Tested-by: Gregory Price <gregory.price@memverge.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
hw/i386/acpi-build.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 145389aa58..4840d11799 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1514,7 +1514,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
aml_append(pkg, aml_eisaid("PNP0A03"));
aml_append(dev, aml_name_decl("_CID", pkg));
aml_append(dev, aml_name_decl("_ADR", aml_int(0)));
- aml_append(dev, aml_name_decl("_UID", aml_int(bus_num)));
build_cxl_osc_method(dev);
} else if (pci_bus_is_express(bus)) {
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
--
2.37.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v4 07/10] tests: acpi: Update q35/DSDT.cxl for removed duplicate UID
2023-02-06 17:28 [PATCH v4 00/10] hw/cxl: CXL emulation cleanups and minor fixes for upstream Jonathan Cameron via
` (5 preceding siblings ...)
2023-02-06 17:28 ` [PATCH v4 06/10] hw/i386/acpi: Drop duplicate _UID entry for CXL root bridge Jonathan Cameron via
@ 2023-02-06 17:28 ` Jonathan Cameron via
[not found] ` <CGME20230228041312uscas1p1baf3e096036cefdc0a843ec47126facc@uscas1p1.samsung.com>
2023-02-06 17:28 ` [PATCH v4 08/10] qemu/bswap: Add const_le64() Jonathan Cameron via
` (2 subsequent siblings)
9 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron via @ 2023-02-06 17:28 UTC (permalink / raw)
To: qemu-devel, Michael Tsirkin
Cc: Ben Widawsky, linux-cxl, linuxarm, Ira Weiny, Gregory Price,
Philippe Mathieu-Daudé
Dropping the ID effects this table in trivial fashion.
Reviewed-by: Gregory Price <gregory.price@memverge.com>
Tested-by: Gregory Price <gregory.price@memverge.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
tests/data/acpi/q35/DSDT.cxl | Bin 9578 -> 9564 bytes
tests/qtest/bios-tables-test-allowed-diff.h | 1 -
2 files changed, 1 deletion(-)
diff --git a/tests/data/acpi/q35/DSDT.cxl b/tests/data/acpi/q35/DSDT.cxl
index 3d18b9672d124a0cf11a79e92c396a1b883d0589..4586b9a18b24acd946cd32c7e3e3a70891a246d2 100644
GIT binary patch
delta 65
zcmaFmb;pa#CD<h-MwNkqQEMaDUKwr|m6-Tor}*e5Z{^9CWUMyF%dcjfyiYC^MM6#<
IB*D!F0I~xVRsaA1
delta 79
zcmccP^~#IOCD<h-OO=6vv2P>SUKwt0m6-Tor}*e5CzZ*UWUScYLp@!%?rjc`U&A<g
SyId%Wytq76o(Cw;!v+8Y7Z@l2
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index 9ce0f596cc..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,2 +1 @@
/* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DSDT.cxl",
--
2.37.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v4 08/10] qemu/bswap: Add const_le64()
2023-02-06 17:28 [PATCH v4 00/10] hw/cxl: CXL emulation cleanups and minor fixes for upstream Jonathan Cameron via
` (6 preceding siblings ...)
2023-02-06 17:28 ` [PATCH v4 07/10] tests: acpi: Update q35/DSDT.cxl for removed duplicate UID Jonathan Cameron via
@ 2023-02-06 17:28 ` Jonathan Cameron via
[not found] ` <CGME20230228041419uscas1p1b9d933dc37c4b6369ef1dea03a54c9e4@uscas1p1.samsung.com>
2023-02-06 17:28 ` [PATCH v4 09/10] qemu/uuid: Add UUID static initializer Jonathan Cameron via
2023-02-06 17:28 ` [PATCH v4 10/10] hw/cxl/mailbox: Use new UUID network order define for cel_uuid Jonathan Cameron via
9 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron via @ 2023-02-06 17:28 UTC (permalink / raw)
To: qemu-devel, Michael Tsirkin
Cc: Ben Widawsky, linux-cxl, linuxarm, Ira Weiny, Gregory Price,
Philippe Mathieu-Daudé
From: Ira Weiny <ira.weiny@intel.com>
Gcc requires constant versions of cpu_to_le* calls.
Add a 64 bit version.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Gregory Price <gregory.price@memverge.com>
Tested-by: Gregory Price <gregory.price@memverge.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
v2: Update comment (Philippe)
---
include/qemu/bswap.h | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
index 3cbe52246b..eb3bcf2520 100644
--- a/include/qemu/bswap.h
+++ b/include/qemu/bswap.h
@@ -129,11 +129,20 @@ CPU_CONVERT(le, 32, uint32_t)
CPU_CONVERT(le, 64, uint64_t)
/*
- * Same as cpu_to_le{16,32}, except that gcc will figure the result is
+ * Same as cpu_to_le{16,32,64}, except that gcc will figure the result is
* a compile-time constant if you pass in a constant. So this can be
* used to initialize static variables.
*/
#if HOST_BIG_ENDIAN
+# define const_le64(_x) \
+ ((((_x) & 0x00000000000000ffU) << 56) | \
+ (((_x) & 0x000000000000ff00U) << 40) | \
+ (((_x) & 0x0000000000ff0000U) << 24) | \
+ (((_x) & 0x00000000ff000000U) << 8) | \
+ (((_x) & 0x000000ff00000000U) >> 8) | \
+ (((_x) & 0x0000ff0000000000U) >> 24) | \
+ (((_x) & 0x00ff000000000000U) >> 40) | \
+ (((_x) & 0xff00000000000000U) >> 56))
# define const_le32(_x) \
((((_x) & 0x000000ffU) << 24) | \
(((_x) & 0x0000ff00U) << 8) | \
@@ -143,6 +152,7 @@ CPU_CONVERT(le, 64, uint64_t)
((((_x) & 0x00ff) << 8) | \
(((_x) & 0xff00) >> 8))
#else
+# define const_le64(_x) (_x)
# define const_le32(_x) (_x)
# define const_le16(_x) (_x)
#endif
--
2.37.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v4 09/10] qemu/uuid: Add UUID static initializer
2023-02-06 17:28 [PATCH v4 00/10] hw/cxl: CXL emulation cleanups and minor fixes for upstream Jonathan Cameron via
` (7 preceding siblings ...)
2023-02-06 17:28 ` [PATCH v4 08/10] qemu/bswap: Add const_le64() Jonathan Cameron via
@ 2023-02-06 17:28 ` Jonathan Cameron via
[not found] ` <CGME20230228041451uscas1p19d32976b917a5b8eaf3cd9b413e911f0@uscas1p1.samsung.com>
2023-02-06 17:28 ` [PATCH v4 10/10] hw/cxl/mailbox: Use new UUID network order define for cel_uuid Jonathan Cameron via
9 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron via @ 2023-02-06 17:28 UTC (permalink / raw)
To: qemu-devel, Michael Tsirkin
Cc: Ben Widawsky, linux-cxl, linuxarm, Ira Weiny, Gregory Price,
Philippe Mathieu-Daudé
From: Ira Weiny <ira.weiny@intel.com>
UUID's are defined as network byte order fields. No static initializer
was available for UUID's in their standard big endian format.
Define a big endian initializer for UUIDs.
Reviewed-by: Gregory Price <gregory.price@memverge.com>
Tested-by: Gregory Price <gregory.price@memverge.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
include/qemu/uuid.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/qemu/uuid.h b/include/qemu/uuid.h
index 9925febfa5..dc40ee1fc9 100644
--- a/include/qemu/uuid.h
+++ b/include/qemu/uuid.h
@@ -61,6 +61,18 @@ typedef struct {
(clock_seq_hi_and_reserved), (clock_seq_low), (node0), (node1), (node2),\
(node3), (node4), (node5) }
+/* Normal (network byte order) UUID */
+#define UUID(time_low, time_mid, time_hi_and_version, \
+ clock_seq_hi_and_reserved, clock_seq_low, node0, node1, node2, \
+ node3, node4, node5) \
+ { ((time_low) >> 24) & 0xff, ((time_low) >> 16) & 0xff, \
+ ((time_low) >> 8) & 0xff, (time_low) & 0xff, \
+ ((time_mid) >> 8) & 0xff, (time_mid) & 0xff, \
+ ((time_hi_and_version) >> 8) & 0xff, (time_hi_and_version) & 0xff, \
+ (clock_seq_hi_and_reserved), (clock_seq_low), \
+ (node0), (node1), (node2), (node3), (node4), (node5) \
+ }
+
#define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-" \
"%02hhx%02hhx-%02hhx%02hhx-" \
"%02hhx%02hhx-" \
--
2.37.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v4 10/10] hw/cxl/mailbox: Use new UUID network order define for cel_uuid
2023-02-06 17:28 [PATCH v4 00/10] hw/cxl: CXL emulation cleanups and minor fixes for upstream Jonathan Cameron via
` (8 preceding siblings ...)
2023-02-06 17:28 ` [PATCH v4 09/10] qemu/uuid: Add UUID static initializer Jonathan Cameron via
@ 2023-02-06 17:28 ` Jonathan Cameron via
[not found] ` <CGME20230228041511uscas1p29bfa83f0efe2632d89d5d76ea1be0245@uscas1p2.samsung.com>
9 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron via @ 2023-02-06 17:28 UTC (permalink / raw)
To: qemu-devel, Michael Tsirkin
Cc: Ben Widawsky, linux-cxl, linuxarm, Ira Weiny, Gregory Price,
Philippe Mathieu-Daudé
From: Ira Weiny <ira.weiny@intel.com>
The cel_uuid was programatically generated previously because there was
no static initializer for network order UUIDs.
Use the new network order initializer for cel_uuid. Adjust
cxl_initialize_mailbox() because it can't fail now.
Update specification reference.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Gregory Price <gregory.price@memverge.com>
Tested-by: Gregory Price <gregory.price@memverge.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
v2:
Make it const (Philippe)
---
hw/cxl/cxl-device-utils.c | 2 +-
hw/cxl/cxl-mailbox-utils.c | 13 ++++++-------
include/hw/cxl/cxl_device.h | 2 +-
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/hw/cxl/cxl-device-utils.c b/hw/cxl/cxl-device-utils.c
index 83ce7a8270..4c5e88aaf5 100644
--- a/hw/cxl/cxl-device-utils.c
+++ b/hw/cxl/cxl-device-utils.c
@@ -267,5 +267,5 @@ void cxl_device_register_init_common(CXLDeviceState *cxl_dstate)
cxl_device_cap_init(cxl_dstate, MEMORY_DEVICE, 0x4000);
memdev_reg_init_common(cxl_dstate);
- assert(cxl_initialize_mailbox(cxl_dstate) == 0);
+ cxl_initialize_mailbox(cxl_dstate);
}
diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c
index 3f67b665f5..206e04a4b8 100644
--- a/hw/cxl/cxl-mailbox-utils.c
+++ b/hw/cxl/cxl-mailbox-utils.c
@@ -193,7 +193,11 @@ static ret_code cmd_timestamp_set(struct cxl_cmd *cmd,
return CXL_MBOX_SUCCESS;
}
-static QemuUUID cel_uuid;
+/* CXL 3.0 8.2.9.5.2.1 Command Effects Log (CEL) */
+static const QemuUUID cel_uuid = {
+ .data = UUID(0x0da9c0b5, 0xbf41, 0x4b78, 0x8f, 0x79,
+ 0x96, 0xb1, 0x62, 0x3b, 0x3f, 0x17)
+};
/* 8.2.9.4.1 */
static ret_code cmd_logs_get_supported(struct cxl_cmd *cmd,
@@ -458,11 +462,8 @@ void cxl_process_mailbox(CXLDeviceState *cxl_dstate)
DOORBELL, 0);
}
-int cxl_initialize_mailbox(CXLDeviceState *cxl_dstate)
+void cxl_initialize_mailbox(CXLDeviceState *cxl_dstate)
{
- /* CXL 2.0: Table 169 Get Supported Logs Log Entry */
- const char *cel_uuidstr = "0da9c0b5-bf41-4b78-8f79-96b1623b3f17";
-
for (int set = 0; set < 256; set++) {
for (int cmd = 0; cmd < 256; cmd++) {
if (cxl_cmd_set[set][cmd].handler) {
@@ -476,6 +477,4 @@ int cxl_initialize_mailbox(CXLDeviceState *cxl_dstate)
}
}
}
-
- return qemu_uuid_parse(cel_uuidstr, &cel_uuid);
}
diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h
index 250adf18b2..7e5ad65c1d 100644
--- a/include/hw/cxl/cxl_device.h
+++ b/include/hw/cxl/cxl_device.h
@@ -170,7 +170,7 @@ CXL_DEVICE_CAPABILITY_HEADER_REGISTER(MEMORY_DEVICE,
CXL_DEVICE_CAP_HDR1_OFFSET +
CXL_DEVICE_CAP_REG_SIZE * 2)
-int cxl_initialize_mailbox(CXLDeviceState *cxl_dstate);
+void cxl_initialize_mailbox(CXLDeviceState *cxl_dstate);
void cxl_process_mailbox(CXLDeviceState *cxl_dstate);
#define cxl_device_cap_init(dstate, reg, cap_id) \
--
2.37.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v4 01/10] hw/mem/cxl_type3: Improve error handling in realize()
[not found] ` <CGME20230228041008uscas1p1296b02da63f7c8c81506d67dafe7ff75@uscas1p1.samsung.com>
@ 2023-02-28 4:10 ` Fan Ni
0 siblings, 0 replies; 21+ messages in thread
From: Fan Ni @ 2023-02-28 4:10 UTC (permalink / raw)
To: Jonathan Cameron
Cc: qemu-devel@nongnu.org, Michael Tsirkin, Ben Widawsky,
linux-cxl@vger.kernel.org, linuxarm@huawei.com, Ira Weiny,
Gregory Price, Philippe Mathieu-Daudé
On Mon, Feb 06, 2023 at 05:28:07PM +0000, Jonathan Cameron wrote:
> msix_init_exclusive_bar() can fail, so if it does cleanup the address space.
>
> Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> Reviewed-by: Gregory Price <gregory.price@memverge.com>
> Tested-by: Gregory Price <gregory.price@memverge.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
Reviewed-by: Fan Ni <fan.ni@samsung.com>
> hw/mem/cxl_type3.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c
> index dae4fd89ca..252822bd82 100644
> --- a/hw/mem/cxl_type3.c
> +++ b/hw/mem/cxl_type3.c
> @@ -401,7 +401,7 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp)
> MemoryRegion *mr = ®s->component_registers;
> uint8_t *pci_conf = pci_dev->config;
> unsigned short msix_num = 1;
> - int i;
> + int i, rc;
>
> if (!cxl_setup_memory(ct3d, errp)) {
> return;
> @@ -438,7 +438,10 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp)
> &ct3d->cxl_dstate.device_registers);
>
> /* MSI(-X) Initailization */
> - msix_init_exclusive_bar(pci_dev, msix_num, 4, NULL);
> + rc = msix_init_exclusive_bar(pci_dev, msix_num, 4, NULL);
> + if (rc) {
> + goto err_address_space_free;
> + }
> for (i = 0; i < msix_num; i++) {
> msix_vector_use(pci_dev, i);
> }
> @@ -450,6 +453,11 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp)
> cxl_cstate->cdat.free_cdat_table = ct3_free_cdat_table;
> cxl_cstate->cdat.private = ct3d;
> cxl_doe_cdat_init(cxl_cstate, errp);
> + return;
> +
> +err_address_space_free:
> + address_space_destroy(&ct3d->hostmem_as);
> + return;
> }
>
> static void ct3_exit(PCIDevice *pci_dev)
> --
> 2.37.2
>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 02/10] hw/pci-bridge/cxl_downstream: Fix type naming mismatch
[not found] ` <CGME20230228041044uscas1p1dfa4b92cb69b2f3c37d33c484521b491@uscas1p1.samsung.com>
@ 2023-02-28 4:10 ` Fan Ni
0 siblings, 0 replies; 21+ messages in thread
From: Fan Ni @ 2023-02-28 4:10 UTC (permalink / raw)
To: Jonathan Cameron
Cc: qemu-devel@nongnu.org, Michael Tsirkin, Ben Widawsky,
linux-cxl@vger.kernel.org, linuxarm@huawei.com, Ira Weiny,
Gregory Price, Philippe Mathieu-Daudé
On Mon, Feb 06, 2023 at 05:28:08PM +0000, Jonathan Cameron wrote:
> Fix capitalization difference between struct name and typedef.
>
> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> Reviewed-by: Gregory Price <gregory.price@memverge.com>
> Tested-by: Gregory Price <gregory.price@memverge.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
Reviewed-by: Fan Ni <fan.ni@samsung.com>
> hw/pci-bridge/cxl_downstream.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/pci-bridge/cxl_downstream.c b/hw/pci-bridge/cxl_downstream.c
> index 3d4e6b59cd..54f507318f 100644
> --- a/hw/pci-bridge/cxl_downstream.c
> +++ b/hw/pci-bridge/cxl_downstream.c
> @@ -15,7 +15,7 @@
> #include "hw/pci/pcie_port.h"
> #include "qapi/error.h"
>
> -typedef struct CXLDownStreamPort {
> +typedef struct CXLDownstreamPort {
> /*< private >*/
> PCIESlot parent_obj;
>
> --
> 2.37.2
>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 03/10] hw/cxl: set cxl-type3 device type to PCI_CLASS_MEMORY_CXL
[not found] ` <CGME20230228041113uscas1p1e62bf38766962db8de58b4c1b6cff804@uscas1p1.samsung.com>
@ 2023-02-28 4:11 ` Fan Ni
0 siblings, 0 replies; 21+ messages in thread
From: Fan Ni @ 2023-02-28 4:11 UTC (permalink / raw)
To: Jonathan Cameron
Cc: qemu-devel@nongnu.org, Michael Tsirkin, Ben Widawsky,
linux-cxl@vger.kernel.org, linuxarm@huawei.com, Ira Weiny,
Gregory Price, Philippe Mathieu-Daudé
On Mon, Feb 06, 2023 at 05:28:09PM +0000, Jonathan Cameron wrote:
> From: Gregory Price <gourry.memverge@gmail.com>
>
> Current code sets to STORAGE_EXPRESS and then overrides it.
>
> Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
> Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> Signed-off-by: Gregory Price <gregory.price@memverge.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
Reviewed-by: Fan Ni <fan.ni@samsung.com>
> hw/mem/cxl_type3.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c
> index 252822bd82..217a5e639b 100644
> --- a/hw/mem/cxl_type3.c
> +++ b/hw/mem/cxl_type3.c
> @@ -408,7 +408,6 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp)
> }
>
> pci_config_set_prog_interface(pci_conf, 0x10);
> - pci_config_set_class(pci_conf, PCI_CLASS_MEMORY_CXL);
>
> pcie_endpoint_cap_init(pci_dev, 0x80);
> if (ct3d->sn != UI64_NULL) {
> @@ -627,7 +626,7 @@ static void ct3_class_init(ObjectClass *oc, void *data)
>
> pc->realize = ct3_realize;
> pc->exit = ct3_exit;
> - pc->class_id = PCI_CLASS_STORAGE_EXPRESS;
> + pc->class_id = PCI_CLASS_MEMORY_CXL;
> pc->vendor_id = PCI_VENDOR_ID_INTEL;
> pc->device_id = 0xd93; /* LVF for now */
> pc->revision = 1;
> --
> 2.37.2
>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 04/10] hw/cxl: Add CXL_CAPACITY_MULTIPLIER definition
[not found] ` <CGME20230228041151uscas1p18d7918f0111d9186a6740c93293a7bc4@uscas1p1.samsung.com>
@ 2023-02-28 4:11 ` Fan Ni
0 siblings, 0 replies; 21+ messages in thread
From: Fan Ni @ 2023-02-28 4:11 UTC (permalink / raw)
To: Jonathan Cameron
Cc: qemu-devel@nongnu.org, Michael Tsirkin, Ben Widawsky,
linux-cxl@vger.kernel.org, linuxarm@huawei.com, Ira Weiny,
Gregory Price, Philippe Mathieu-Daudé
On Mon, Feb 06, 2023 at 05:28:10PM +0000, Jonathan Cameron wrote:
> From: Gregory Price <gourry.memverge@gmail.com>
>
> Remove usage of magic numbers when accessing capacity fields and replace
> with CXL_CAPACITY_MULTIPLIER, matching the kernel definition.
>
> Signed-off-by: Gregory Price <gregory.price@memverge.com>
> Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
> ---
> v2:
> Change to 256 * MiB and include qemu/units.h (Philippe Mathieu-Daudé)
> ---
> hw/cxl/cxl-mailbox-utils.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c
> index bc1bb18844..3f67b665f5 100644
> --- a/hw/cxl/cxl-mailbox-utils.c
> +++ b/hw/cxl/cxl-mailbox-utils.c
> @@ -12,8 +12,11 @@
> #include "hw/pci/pci.h"
> #include "qemu/cutils.h"
> #include "qemu/log.h"
> +#include "qemu/units.h"
> #include "qemu/uuid.h"
>
> +#define CXL_CAPACITY_MULTIPLIER (256 * MiB)
> +
> /*
> * How to add a new command, example. The command set FOO, with cmd BAR.
> * 1. Add the command set and cmd to the enum.
> @@ -138,7 +141,7 @@ static ret_code cmd_firmware_update_get_info(struct cxl_cmd *cmd,
> } QEMU_PACKED *fw_info;
> QEMU_BUILD_BUG_ON(sizeof(*fw_info) != 0x50);
>
> - if (cxl_dstate->pmem_size < (256 << 20)) {
> + if (cxl_dstate->pmem_size < CXL_CAPACITY_MULTIPLIER) {
> return CXL_MBOX_INTERNAL_ERROR;
> }
>
> @@ -283,7 +286,7 @@ static ret_code cmd_identify_memory_device(struct cxl_cmd *cmd,
> CXLType3Class *cvc = CXL_TYPE3_GET_CLASS(ct3d);
> uint64_t size = cxl_dstate->pmem_size;
>
> - if (!QEMU_IS_ALIGNED(size, 256 << 20)) {
> + if (!QEMU_IS_ALIGNED(size, CXL_CAPACITY_MULTIPLIER)) {
> return CXL_MBOX_INTERNAL_ERROR;
> }
>
> @@ -293,8 +296,8 @@ static ret_code cmd_identify_memory_device(struct cxl_cmd *cmd,
> /* PMEM only */
> snprintf(id->fw_revision, 0x10, "BWFW VERSION %02d", 0);
>
> - id->total_capacity = size / (256 << 20);
> - id->persistent_capacity = size / (256 << 20);
> + id->total_capacity = size / CXL_CAPACITY_MULTIPLIER;
> + id->persistent_capacity = size / CXL_CAPACITY_MULTIPLIER;
> id->lsa_size = cvc->get_lsa_size(ct3d);
>
> *len = sizeof(*id);
> @@ -314,14 +317,14 @@ static ret_code cmd_ccls_get_partition_info(struct cxl_cmd *cmd,
> QEMU_BUILD_BUG_ON(sizeof(*part_info) != 0x20);
> uint64_t size = cxl_dstate->pmem_size;
>
> - if (!QEMU_IS_ALIGNED(size, 256 << 20)) {
> + if (!QEMU_IS_ALIGNED(size, CXL_CAPACITY_MULTIPLIER)) {
> return CXL_MBOX_INTERNAL_ERROR;
> }
>
> /* PMEM only */
> part_info->active_vmem = 0;
> part_info->next_vmem = 0;
> - part_info->active_pmem = size / (256 << 20);
> + part_info->active_pmem = size / CXL_CAPACITY_MULTIPLIER;
> part_info->next_pmem = 0;
>
> *len = sizeof(*part_info);
> --
> 2.37.2
>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 05/10] tests/acpi: Allow update of q35/DSDT.cxl
[not found] ` <CGME20230228041219uscas1p140e49d902024e0eab1eb1cf3cba168fa@uscas1p1.samsung.com>
@ 2023-02-28 4:12 ` Fan Ni
0 siblings, 0 replies; 21+ messages in thread
From: Fan Ni @ 2023-02-28 4:12 UTC (permalink / raw)
To: Jonathan Cameron
Cc: qemu-devel@nongnu.org, Michael Tsirkin, Ben Widawsky,
linux-cxl@vger.kernel.org, linuxarm@huawei.com, Ira Weiny,
Gregory Price, Philippe Mathieu-Daudé
On Mon, Feb 06, 2023 at 05:28:11PM +0000, Jonathan Cameron wrote:
> Next patch will drop duplicate _UID entry so allow update.
>
> Reviewed-by: Gregory Price <gregory.price@memverge.com>
> Tested-by: Gregory Price <gregory.price@memverge.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
> ---
> tests/qtest/bios-tables-test-allowed-diff.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
> index dfb8523c8b..9ce0f596cc 100644
> --- a/tests/qtest/bios-tables-test-allowed-diff.h
> +++ b/tests/qtest/bios-tables-test-allowed-diff.h
> @@ -1 +1,2 @@
> /* List of comma-separated changed AML files to ignore */
> +"tests/data/acpi/q35/DSDT.cxl",
> --
> 2.37.2
>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 06/10] hw/i386/acpi: Drop duplicate _UID entry for CXL root bridge
[not found] ` <CGME20230228041253uscas1p229d8375093fdd4d2de21be8921e35e32@uscas1p2.samsung.com>
@ 2023-02-28 4:12 ` Fan Ni
0 siblings, 0 replies; 21+ messages in thread
From: Fan Ni @ 2023-02-28 4:12 UTC (permalink / raw)
To: Jonathan Cameron
Cc: qemu-devel@nongnu.org, Michael Tsirkin, Ben Widawsky,
linux-cxl@vger.kernel.org, linuxarm@huawei.com, Ira Weiny,
Gregory Price, Philippe Mathieu-Daudé
On Mon, Feb 06, 2023 at 05:28:12PM +0000, Jonathan Cameron wrote:
> Noticed as this prevents iASL disasembling the DSDT table.
>
> Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> Reviewed-by: Gregory Price <gregory.price@memverge.com>
> Tested-by: Gregory Price <gregory.price@memverge.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
Reviewed-by: Fan Ni <fan.ni@samsung.com>
> hw/i386/acpi-build.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 145389aa58..4840d11799 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -1514,7 +1514,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
> aml_append(pkg, aml_eisaid("PNP0A03"));
> aml_append(dev, aml_name_decl("_CID", pkg));
> aml_append(dev, aml_name_decl("_ADR", aml_int(0)));
> - aml_append(dev, aml_name_decl("_UID", aml_int(bus_num)));
> build_cxl_osc_method(dev);
> } else if (pci_bus_is_express(bus)) {
> aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
> --
> 2.37.2
>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 07/10] tests: acpi: Update q35/DSDT.cxl for removed duplicate UID
[not found] ` <CGME20230228041312uscas1p1baf3e096036cefdc0a843ec47126facc@uscas1p1.samsung.com>
@ 2023-02-28 4:13 ` Fan Ni
0 siblings, 0 replies; 21+ messages in thread
From: Fan Ni @ 2023-02-28 4:13 UTC (permalink / raw)
To: Jonathan Cameron
Cc: qemu-devel@nongnu.org, Michael Tsirkin, Ben Widawsky,
linux-cxl@vger.kernel.org, linuxarm@huawei.com, Ira Weiny,
Gregory Price, Philippe Mathieu-Daudé
On Mon, Feb 06, 2023 at 05:28:13PM +0000, Jonathan Cameron wrote:
> Dropping the ID effects this table in trivial fashion.
>
> Reviewed-by: Gregory Price <gregory.price@memverge.com>
> Tested-by: Gregory Price <gregory.price@memverge.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
Reviewed-by: Fan Ni <fan.ni@samsung.com>
> tests/data/acpi/q35/DSDT.cxl | Bin 9578 -> 9564 bytes
> tests/qtest/bios-tables-test-allowed-diff.h | 1 -
> 2 files changed, 1 deletion(-)
>
> diff --git a/tests/data/acpi/q35/DSDT.cxl b/tests/data/acpi/q35/DSDT.cxl
> index 3d18b9672d124a0cf11a79e92c396a1b883d0589..4586b9a18b24acd946cd32c7e3e3a70891a246d2 100644
> GIT binary patch
> delta 65
> zcmaFmb;pa#CD<h-MwNkqQEMaDUKwr|m6-Tor}*e5Z{^9CWUMyF%dcjfyiYC^MM6#<
> IB*D!F0I~xVRsaA1
>
> delta 79
> zcmccP^~#IOCD<h-OO=6vv2P>SUKwt0m6-Tor}*e5CzZ*UWUScYLp@!%?rjc`U&A<g
> SyId%Wytq76o(Cw;!v+8Y7Z@l2
>
> diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
> index 9ce0f596cc..dfb8523c8b 100644
> --- a/tests/qtest/bios-tables-test-allowed-diff.h
> +++ b/tests/qtest/bios-tables-test-allowed-diff.h
> @@ -1,2 +1 @@
> /* List of comma-separated changed AML files to ignore */
> -"tests/data/acpi/q35/DSDT.cxl",
> --
> 2.37.2
>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 08/10] qemu/bswap: Add const_le64()
[not found] ` <CGME20230228041419uscas1p1b9d933dc37c4b6369ef1dea03a54c9e4@uscas1p1.samsung.com>
@ 2023-02-28 4:14 ` Fan Ni
0 siblings, 0 replies; 21+ messages in thread
From: Fan Ni @ 2023-02-28 4:14 UTC (permalink / raw)
To: Jonathan Cameron
Cc: qemu-devel@nongnu.org, Michael Tsirkin, Ben Widawsky,
linux-cxl@vger.kernel.org, linuxarm@huawei.com, Ira Weiny,
Gregory Price, Philippe Mathieu-Daudé
On Mon, Feb 06, 2023 at 05:28:14PM +0000, Jonathan Cameron wrote:
> From: Ira Weiny <ira.weiny@intel.com>
>
> Gcc requires constant versions of cpu_to_le* calls.
>
> Add a 64 bit version.
>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Gregory Price <gregory.price@memverge.com>
> Tested-by: Gregory Price <gregory.price@memverge.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
> ---
> v2: Update comment (Philippe)
> ---
> include/qemu/bswap.h | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
> index 3cbe52246b..eb3bcf2520 100644
> --- a/include/qemu/bswap.h
> +++ b/include/qemu/bswap.h
> @@ -129,11 +129,20 @@ CPU_CONVERT(le, 32, uint32_t)
> CPU_CONVERT(le, 64, uint64_t)
>
> /*
> - * Same as cpu_to_le{16,32}, except that gcc will figure the result is
> + * Same as cpu_to_le{16,32,64}, except that gcc will figure the result is
> * a compile-time constant if you pass in a constant. So this can be
> * used to initialize static variables.
> */
> #if HOST_BIG_ENDIAN
> +# define const_le64(_x) \
> + ((((_x) & 0x00000000000000ffU) << 56) | \
> + (((_x) & 0x000000000000ff00U) << 40) | \
> + (((_x) & 0x0000000000ff0000U) << 24) | \
> + (((_x) & 0x00000000ff000000U) << 8) | \
> + (((_x) & 0x000000ff00000000U) >> 8) | \
> + (((_x) & 0x0000ff0000000000U) >> 24) | \
> + (((_x) & 0x00ff000000000000U) >> 40) | \
> + (((_x) & 0xff00000000000000U) >> 56))
> # define const_le32(_x) \
> ((((_x) & 0x000000ffU) << 24) | \
> (((_x) & 0x0000ff00U) << 8) | \
> @@ -143,6 +152,7 @@ CPU_CONVERT(le, 64, uint64_t)
> ((((_x) & 0x00ff) << 8) | \
> (((_x) & 0xff00) >> 8))
> #else
> +# define const_le64(_x) (_x)
> # define const_le32(_x) (_x)
> # define const_le16(_x) (_x)
> #endif
> --
> 2.37.2
>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 09/10] qemu/uuid: Add UUID static initializer
[not found] ` <CGME20230228041451uscas1p19d32976b917a5b8eaf3cd9b413e911f0@uscas1p1.samsung.com>
@ 2023-02-28 4:14 ` Fan Ni
0 siblings, 0 replies; 21+ messages in thread
From: Fan Ni @ 2023-02-28 4:14 UTC (permalink / raw)
To: Jonathan Cameron
Cc: qemu-devel@nongnu.org, Michael Tsirkin, Ben Widawsky,
linux-cxl@vger.kernel.org, linuxarm@huawei.com, Ira Weiny,
Gregory Price, Philippe Mathieu-Daudé
On Mon, Feb 06, 2023 at 05:28:15PM +0000, Jonathan Cameron wrote:
> From: Ira Weiny <ira.weiny@intel.com>
>
> UUID's are defined as network byte order fields. No static initializer
> was available for UUID's in their standard big endian format.
>
> Define a big endian initializer for UUIDs.
>
> Reviewed-by: Gregory Price <gregory.price@memverge.com>
> Tested-by: Gregory Price <gregory.price@memverge.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
> ---
> include/qemu/uuid.h | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/include/qemu/uuid.h b/include/qemu/uuid.h
> index 9925febfa5..dc40ee1fc9 100644
> --- a/include/qemu/uuid.h
> +++ b/include/qemu/uuid.h
> @@ -61,6 +61,18 @@ typedef struct {
> (clock_seq_hi_and_reserved), (clock_seq_low), (node0), (node1), (node2),\
> (node3), (node4), (node5) }
>
> +/* Normal (network byte order) UUID */
> +#define UUID(time_low, time_mid, time_hi_and_version, \
> + clock_seq_hi_and_reserved, clock_seq_low, node0, node1, node2, \
> + node3, node4, node5) \
> + { ((time_low) >> 24) & 0xff, ((time_low) >> 16) & 0xff, \
> + ((time_low) >> 8) & 0xff, (time_low) & 0xff, \
> + ((time_mid) >> 8) & 0xff, (time_mid) & 0xff, \
> + ((time_hi_and_version) >> 8) & 0xff, (time_hi_and_version) & 0xff, \
> + (clock_seq_hi_and_reserved), (clock_seq_low), \
> + (node0), (node1), (node2), (node3), (node4), (node5) \
> + }
> +
> #define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-" \
> "%02hhx%02hhx-%02hhx%02hhx-" \
> "%02hhx%02hhx-" \
> --
> 2.37.2
>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 10/10] hw/cxl/mailbox: Use new UUID network order define for cel_uuid
[not found] ` <CGME20230228041511uscas1p29bfa83f0efe2632d89d5d76ea1be0245@uscas1p2.samsung.com>
@ 2023-02-28 4:15 ` Fan Ni
0 siblings, 0 replies; 21+ messages in thread
From: Fan Ni @ 2023-02-28 4:15 UTC (permalink / raw)
To: Jonathan Cameron
Cc: qemu-devel@nongnu.org, Michael Tsirkin, Ben Widawsky,
linux-cxl@vger.kernel.org, linuxarm@huawei.com, Ira Weiny,
Gregory Price, Philippe Mathieu-Daudé
On Mon, Feb 06, 2023 at 05:28:16PM +0000, Jonathan Cameron wrote:
> From: Ira Weiny <ira.weiny@intel.com>
>
> The cel_uuid was programatically generated previously because there was
> no static initializer for network order UUIDs.
>
> Use the new network order initializer for cel_uuid. Adjust
> cxl_initialize_mailbox() because it can't fail now.
>
> Update specification reference.
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Gregory Price <gregory.price@memverge.com>
> Tested-by: Gregory Price <gregory.price@memverge.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
> ---
> v2:
> Make it const (Philippe)
> ---
> hw/cxl/cxl-device-utils.c | 2 +-
> hw/cxl/cxl-mailbox-utils.c | 13 ++++++-------
> include/hw/cxl/cxl_device.h | 2 +-
> 3 files changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/hw/cxl/cxl-device-utils.c b/hw/cxl/cxl-device-utils.c
> index 83ce7a8270..4c5e88aaf5 100644
> --- a/hw/cxl/cxl-device-utils.c
> +++ b/hw/cxl/cxl-device-utils.c
> @@ -267,5 +267,5 @@ void cxl_device_register_init_common(CXLDeviceState *cxl_dstate)
> cxl_device_cap_init(cxl_dstate, MEMORY_DEVICE, 0x4000);
> memdev_reg_init_common(cxl_dstate);
>
> - assert(cxl_initialize_mailbox(cxl_dstate) == 0);
> + cxl_initialize_mailbox(cxl_dstate);
> }
> diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c
> index 3f67b665f5..206e04a4b8 100644
> --- a/hw/cxl/cxl-mailbox-utils.c
> +++ b/hw/cxl/cxl-mailbox-utils.c
> @@ -193,7 +193,11 @@ static ret_code cmd_timestamp_set(struct cxl_cmd *cmd,
> return CXL_MBOX_SUCCESS;
> }
>
> -static QemuUUID cel_uuid;
> +/* CXL 3.0 8.2.9.5.2.1 Command Effects Log (CEL) */
> +static const QemuUUID cel_uuid = {
> + .data = UUID(0x0da9c0b5, 0xbf41, 0x4b78, 0x8f, 0x79,
> + 0x96, 0xb1, 0x62, 0x3b, 0x3f, 0x17)
> +};
>
> /* 8.2.9.4.1 */
> static ret_code cmd_logs_get_supported(struct cxl_cmd *cmd,
> @@ -458,11 +462,8 @@ void cxl_process_mailbox(CXLDeviceState *cxl_dstate)
> DOORBELL, 0);
> }
>
> -int cxl_initialize_mailbox(CXLDeviceState *cxl_dstate)
> +void cxl_initialize_mailbox(CXLDeviceState *cxl_dstate)
> {
> - /* CXL 2.0: Table 169 Get Supported Logs Log Entry */
> - const char *cel_uuidstr = "0da9c0b5-bf41-4b78-8f79-96b1623b3f17";
> -
> for (int set = 0; set < 256; set++) {
> for (int cmd = 0; cmd < 256; cmd++) {
> if (cxl_cmd_set[set][cmd].handler) {
> @@ -476,6 +477,4 @@ int cxl_initialize_mailbox(CXLDeviceState *cxl_dstate)
> }
> }
> }
> -
> - return qemu_uuid_parse(cel_uuidstr, &cel_uuid);
> }
> diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h
> index 250adf18b2..7e5ad65c1d 100644
> --- a/include/hw/cxl/cxl_device.h
> +++ b/include/hw/cxl/cxl_device.h
> @@ -170,7 +170,7 @@ CXL_DEVICE_CAPABILITY_HEADER_REGISTER(MEMORY_DEVICE,
> CXL_DEVICE_CAP_HDR1_OFFSET +
> CXL_DEVICE_CAP_REG_SIZE * 2)
>
> -int cxl_initialize_mailbox(CXLDeviceState *cxl_dstate);
> +void cxl_initialize_mailbox(CXLDeviceState *cxl_dstate);
> void cxl_process_mailbox(CXLDeviceState *cxl_dstate);
>
> #define cxl_device_cap_init(dstate, reg, cap_id) \
> --
> 2.37.2
>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2023-02-28 4:16 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-06 17:28 [PATCH v4 00/10] hw/cxl: CXL emulation cleanups and minor fixes for upstream Jonathan Cameron via
2023-02-06 17:28 ` [PATCH v4 01/10] hw/mem/cxl_type3: Improve error handling in realize() Jonathan Cameron via
[not found] ` <CGME20230228041008uscas1p1296b02da63f7c8c81506d67dafe7ff75@uscas1p1.samsung.com>
2023-02-28 4:10 ` Fan Ni
2023-02-06 17:28 ` [PATCH v4 02/10] hw/pci-bridge/cxl_downstream: Fix type naming mismatch Jonathan Cameron via
[not found] ` <CGME20230228041044uscas1p1dfa4b92cb69b2f3c37d33c484521b491@uscas1p1.samsung.com>
2023-02-28 4:10 ` Fan Ni
2023-02-06 17:28 ` [PATCH v4 03/10] hw/cxl: set cxl-type3 device type to PCI_CLASS_MEMORY_CXL Jonathan Cameron via
[not found] ` <CGME20230228041113uscas1p1e62bf38766962db8de58b4c1b6cff804@uscas1p1.samsung.com>
2023-02-28 4:11 ` Fan Ni
2023-02-06 17:28 ` [PATCH v4 04/10] hw/cxl: Add CXL_CAPACITY_MULTIPLIER definition Jonathan Cameron via
[not found] ` <CGME20230228041151uscas1p18d7918f0111d9186a6740c93293a7bc4@uscas1p1.samsung.com>
2023-02-28 4:11 ` Fan Ni
2023-02-06 17:28 ` [PATCH v4 05/10] tests/acpi: Allow update of q35/DSDT.cxl Jonathan Cameron via
[not found] ` <CGME20230228041219uscas1p140e49d902024e0eab1eb1cf3cba168fa@uscas1p1.samsung.com>
2023-02-28 4:12 ` Fan Ni
2023-02-06 17:28 ` [PATCH v4 06/10] hw/i386/acpi: Drop duplicate _UID entry for CXL root bridge Jonathan Cameron via
[not found] ` <CGME20230228041253uscas1p229d8375093fdd4d2de21be8921e35e32@uscas1p2.samsung.com>
2023-02-28 4:12 ` Fan Ni
2023-02-06 17:28 ` [PATCH v4 07/10] tests: acpi: Update q35/DSDT.cxl for removed duplicate UID Jonathan Cameron via
[not found] ` <CGME20230228041312uscas1p1baf3e096036cefdc0a843ec47126facc@uscas1p1.samsung.com>
2023-02-28 4:13 ` Fan Ni
2023-02-06 17:28 ` [PATCH v4 08/10] qemu/bswap: Add const_le64() Jonathan Cameron via
[not found] ` <CGME20230228041419uscas1p1b9d933dc37c4b6369ef1dea03a54c9e4@uscas1p1.samsung.com>
2023-02-28 4:14 ` Fan Ni
2023-02-06 17:28 ` [PATCH v4 09/10] qemu/uuid: Add UUID static initializer Jonathan Cameron via
[not found] ` <CGME20230228041451uscas1p19d32976b917a5b8eaf3cd9b413e911f0@uscas1p1.samsung.com>
2023-02-28 4:14 ` Fan Ni
2023-02-06 17:28 ` [PATCH v4 10/10] hw/cxl/mailbox: Use new UUID network order define for cel_uuid Jonathan Cameron via
[not found] ` <CGME20230228041511uscas1p29bfa83f0efe2632d89d5d76ea1be0245@uscas1p2.samsung.com>
2023-02-28 4:15 ` Fan Ni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).