Re: [PATCH 1/3] include/hw/pci: Attach BDF to Memory Attributes

2025-04-24 Thread Jason Chien
:28寫道: > On Sun, Mar 02, 2025 at 05:12:07PM +0800, Jason Chien wrote: > > This commit adds the BDF to the memory attributes for DMA operations. > > > > Signed-off-by: Jason Chien > > --- > > include/hw/pci/pci_device.h | 10 -- > > 1 file changed, 8 insert

Re: [PATCH 1/3] include/hw/pci: Attach BDF to Memory Attributes

2025-04-14 Thread Jason Chien
Ping. Jason Chien 於 2025年3月20日 週四 上午12:40寫道: > Ping > > Jason Chien 於 2025年3月13日 週四 上午12:59寫道: > >> Ping. >> >> Michael/Marcel, would you mind taking a look? Thanks! >> >> >> Jason >> >> Daniel Henrique Barboza 於 2025年3月7日 週五 >

Re: [PATCH 0/4] Integrate IOMMUs with PCI hosts that have ATUs

2025-03-19 Thread Jason Chien
Ping Jason Chien 於 2025年3月8日 週六 上午4:40寫道: > The struct PCIIOMMUOps is designed for use by an IOMMU, but many PCI hosts > also utilize it to implement their ATUs, preventing coexistence with > IOMMUs. > Overwriting a PCI host’s PCIIOMMUOps disrupts its translation rules. > >

Re: [PATCH] hw/misc/edu: Rename macros indicating the direction of DMA operations

2025-03-19 Thread Jason Chien
the direction easier to differentiate. Something like EDU_DMA_TO_PCI_BUS and EDU_DMA_FROM_PCI_BUS would also work. Do you have any suggestions? thanks Peter Maydell 於 2025年3月12日 週三 上午2:41寫道: > On Thu, 27 Feb 2025 at 07:32, Jason Chien wrote: > > > > This commit renames the macro

Re: [PATCH 1/3] include/hw/pci: Attach BDF to Memory Attributes

2025-03-19 Thread Jason Chien
Ping Jason Chien 於 2025年3月13日 週四 上午12:59寫道: > Ping. > > Michael/Marcel, would you mind taking a look? Thanks! > > > Jason > > Daniel Henrique Barboza 於 2025年3月7日 週五 > 下午8:40寫道: > >> >> >> On 3/2/25 6:12 AM, Jason Chien wrote: >> >

Re: [PATCH 1/3] include/hw/pci: Attach BDF to Memory Attributes

2025-03-12 Thread Jason Chien
Ping. Michael/Marcel, would you mind taking a look? Thanks! Jason Daniel Henrique Barboza 於 2025年3月7日 週五 下午8:40寫道: > > > On 3/2/25 6:12 AM, Jason Chien wrote: > > This commit adds the BDF to the memory attributes for DMA operations. > > > > Signed-off-by: Jason Ch

Re: [PATCH] hw/misc/edu: Rename macros indicating the direction of DMA operations

2025-03-11 Thread Jason Chien
ping Jason Chien 於 2025年2月27日 週四 下午3:30寫道: > This commit renames the macros to accurately reflect the direction of > DMA operations. > > EDU_DMA_TO_PCI now represents reading memory content into the EDU buffer, > while EDU_DMA_FROM_PCI represents writing EDU buffer content to

[PATCH 3/4] hw/pci-host/designware: Implement PCIIOMMUOps.set_downstream_mr()

2025-03-07 Thread Jason Chien
x27;s downstream memory region via pci_setup_iommu_downstream_mr() without competing for PCIIOMMUOps. Signed-off-by: Jason Chien --- hw/pci-host/designware.c | 18 +++--- include/hw/pci-host/designware.h | 2 ++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/hw/pci

[PATCH 0/4] Integrate IOMMUs with PCI hosts that have ATUs

2025-03-07 Thread Jason Chien
from PCI hosts to the IOMMU, enabling proper integration. The final patch depends on another patch series: https://lists.nongnu.org/archive/html/qemu-riscv/2025-03/msg3.html Jason Chien (4): include/hw/pci: Introduce a callback to set the downstream mr of PCI hosts hw/pci: Introduce an

[PATCH 4/4] hw/riscv/riscv-iommu: Connect the IOMMU with PCI hosts that have ATUs

2025-03-07 Thread Jason Chien
When the IOMMU detects that bus->iommu_ops has been registered, indicating the presence of an ATU, it sets the bus's downstream memory region to ensure transactions are directed to the IOMMU. Signed-off-by: Jason Chien --- hw/riscv/riscv-iommu.c | 15 ++- 1 file cha

[PATCH 2/4] hw/pci: Introduce an API to set PCI host downstream mr for IOMMU integration

2025-03-07 Thread Jason Chien
When an IOMMU detects that a PCI host has registered struct PCIIOMMUOps, it should call pci_setup_iommu_downstream_mr(), which invokes PCIIOMMUOps.set_downstream_mr() to configure the PCI host's downstream memory region, directing inbound transactions to the IOMMU. Signed-off-by: Jason

[PATCH 1/4] include/hw/pci: Introduce a callback to set the downstream mr of PCI hosts

2025-03-07 Thread Jason Chien
coexist. Signed-off-by: Jason Chien --- include/hw/pci/pci.h | 12 1 file changed, 12 insertions(+) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 4002bbeebd..fcf648da19 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -391,6 +391,18 @@ typedef struct

[PATCH 2/3] hw/riscv/riscv-iommu: Obtain Device IDs from Memory Attributes

2025-03-02 Thread Jason Chien
the memory attributes of the requester devices, ensuring accuracy. Signed-off-by: Jason Chien --- hw/riscv/riscv-iommu.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/riscv/riscv-iommu.c b/hw/riscv/riscv-iommu.c index d46beb2d64..b72ce8e6d0 100644 --- a/hw/riscv

[PATCH 3/3] hw/riscv/riscv_iommu: Remove the "bus" property

2025-03-02 Thread Jason Chien
bus, whereas no such restriction exists. With the IOMMU now retrieving the latest device IDs from memory attributes, there is no longer a need to set or update device IDs. Signed-off-by: Jason Chien --- hw/riscv/riscv-iommu.c | 7 --- hw/riscv/riscv-iommu.h | 1 - 2 files changed, 8

[PATCH 1/3] include/hw/pci: Attach BDF to Memory Attributes

2025-03-02 Thread Jason Chien
This commit adds the BDF to the memory attributes for DMA operations. Signed-off-by: Jason Chien --- include/hw/pci/pci_device.h | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h index add208edfa..968f1ba3e9

[PATCH 0/3] Enhancing Device Identification in RISC-V IOMMU Using Memory Attributes

2025-03-02 Thread Jason Chien
vary across endpoints, exposing a single property to pre-set them is unnecessary and incorrect. With device IDs now retrieved dynamically, this property is no longer required. Jason Chien (3): include/hw/pci: Attach BDF to Memory Attributes hw/riscv/riscv-iommu: Obtain Device IDs from Memory

Re: [PATCH] hw/riscv/riscv-iommu: Fix process directory table walk

2025-03-01 Thread Jason Chien
> > Thanks, > > Daniel > > On 2/27/25 4:34 AM, Jason Chien wrote: > > The PPN field in a non-leaf PDT entry is positioned differently from that > > in a leaf PDT entry. The original implementation incorrectly used the > leaf > > entry's PPN mask to extract th

[PATCH v2] hw/riscv/riscv-iommu: Fix process directory table walk

2025-03-01 Thread Jason Chien
perly define the fields for non-leaf PDT entries and corrects the page table walk. Signed-off-by: Jason Chien --- hw/riscv/riscv-iommu-bits.h | 6 +- hw/riscv/riscv-iommu.c | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/riscv/riscv-iommu-bits.h b/hw/riscv/riscv-

[PATCH] hw/riscv/riscv-iommu: Fix process directory table walk

2025-02-26 Thread Jason Chien
perly define the fields for non-leaf PDT entries and corrects the page table walk. Signed-off-by: Jason Chien --- hw/riscv/riscv-iommu-bits.h | 6 +- hw/riscv/riscv-iommu.c | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/riscv/riscv-iommu-bits.h b/hw/riscv/riscv-

[PATCH] hw/misc/edu: Rename macros indicating the direction of DMA operations

2025-02-26 Thread Jason Chien
reversed. Signed-off-by: Jason Chien --- hw/misc/edu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/misc/edu.c b/hw/misc/edu.c index 504178b4a2..1353c67dc2 100644 --- a/hw/misc/edu.c +++ b/hw/misc/edu.c @@ -63,8 +63,8 @@ struct EduState { #define EDU_DMA_RUN

Re: [PATCH v3 1/2] hw/riscv/riscv-iommu: Remove redundant struct members

2025-01-22 Thread Jason Chien
Ping Jason Chien 於 2025年1月15日 週三 下午10:17寫道: > Initially, the IOMMU would create a thread, but this thread was removed in > the merged version. The struct members for thread control should have been > removed as well, but they were not removed in commit 0c54acb8243 > ("hw/riscv:

[PATCH v3 1/2] hw/riscv/riscv-iommu: Remove redundant struct members

2025-01-15 Thread Jason Chien
Initially, the IOMMU would create a thread, but this thread was removed in the merged version. The struct members for thread control should have been removed as well, but they were not removed in commit 0c54acb8243 ("hw/riscv: add RISC-V IOMMU base emulation"). Signed-off-by: J

[PATCH v3 2/2] hw/riscv/riscv-iommu-bits: Remove duplicate definitions

2025-01-15 Thread Jason Chien
The header contains duplicate macro definitions. This commit eliminates the duplicate part. Signed-off-by: Jason Chien Reviewed-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones --- hw/riscv/riscv-iommu-bits.h | 22 ++ 1 file changed, 6 insertions(+), 16 deletions

[PATCH v2 2/2] hw/riscv/riscv-iommu-bits: Remove duplicate definitions

2025-01-14 Thread Jason Chien
The header contains duplicate macro definitions. This commit eliminates the duplicate part. Signed-off-by: Jason Chien Reviewed-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones --- hw/riscv/riscv-iommu-bits.h | 22 ++ 1 file changed, 6 insertions(+), 16 deletions

[PATCH v2 1/2] hw/riscv/riscv-iommu: Remove redundant struct members

2025-01-14 Thread Jason Chien
Initially, the IOMMU would create a thread, but this thread was removed in the merged version. The struct members for thread control should have been removed as well, but they were not removed at that time. Signed-off-by: Jason Chien Reviewed-by: Daniel Henrique Barboza Reviewed-by: Andrew

[PATCH 1/2] hw/riscv/riscv-iommu: Remove redundant variables

2025-01-14 Thread Jason Chien
Signed-off-by: Jason Chien --- hw/riscv/riscv-iommu.h | 5 - 1 file changed, 5 deletions(-) diff --git a/hw/riscv/riscv-iommu.h b/hw/riscv/riscv-iommu.h index 9424989df4..fa8a50fa24 100644 --- a/hw/riscv/riscv-iommu.h +++ b/hw/riscv/riscv-iommu.h @@ -58,11 +58,6 @@ struct RISCVIOMMUState

[PATCH 2/2] hw/riscv/riscv-iommu-bits: Remove redundant definitions

2025-01-14 Thread Jason Chien
Signed-off-by: Jason Chien --- hw/riscv/riscv-iommu-bits.h | 22 ++ 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/hw/riscv/riscv-iommu-bits.h b/hw/riscv/riscv-iommu-bits.h index 485f36b9c9..de599b80d6 100644 --- a/hw/riscv/riscv-iommu-bits.h +++ b/hw/riscv

Re: [RFC PATCH 0/6] Avoid contention for PCIIOMMUOps between IOMMU and PCIe host

2025-01-09 Thread Jason Chien
Ping. Jason Chien 於 2024年12月16日 週一 上午8:49寫道: > When PCIIOMMUOps.get_address_space() is already registered by the pci host, > e.g. TYPE_DESIGNWARE_PCIE_HOST, IOMMU cannot overwrite this hook without > breaking the PCIe translation rule, which means that IOMMU and the pci host > ca

Re: [PATCH] hw/riscv/riscv-iommu.c: Introduce a translation tag for the page table cache

2025-01-07 Thread Jason Chien
Hi Daniel, There is no response from Tomasz. Should this patch be merged? Jason Chien 於 2024年12月18日 週三 下午5:52寫道: > Ping. > > Jason Chien 於 2024年11月25日 週一 下午8:49寫道: > >> Hi Tomasz, any thoughs? >> >> Daniel Henrique Barboza 於 2024年11月12日 週二 >> 下午8:26寫道: >

Re: [PATCH] hw/riscv/riscv-iommu.c: Introduce a translation tag for the page table cache

2024-12-18 Thread Jason Chien
Ping. Jason Chien 於 2024年11月25日 週一 下午8:49寫道: > Hi Tomasz, any thoughs? > > Daniel Henrique Barboza 於 2024年11月12日 週二 > 下午8:26寫道: > >> >> CCing Tomasz >> >> On 11/8/24 8:01 AM, Jason Chien wrote: >> > This commit introduces a translation tag to avo

[RFC PATCH 2/6] hw/pci: Add an API to set the downstream memory region of a PCI bus

2024-12-15 Thread Jason Chien
pci_setup_iommu_downstream_mem() invokes PCIIOMMUOps.set_memory_region() to set the downstream memroy region of a PCI bus. Signed-off-by: Jason Chien --- hw/pci/pci.c | 6 ++ include/hw/pci/pci.h | 7 +++ 2 files changed, 13 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci

[RFC PATCH 5/6] hw/riscv/riscv-iommu: Acquire device IDs dynamically

2024-12-15 Thread Jason Chien
When all memory transactions from a PCIe host write to the same IOMMU memory region, we need to distinguish the source device dynamically. Signed-off-by: Jason Chien --- hw/riscv/riscv-iommu.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/hw/riscv/riscv

[RFC PATCH 6/6] include/hw/pci: Send PCI dma requests with memory attributes containing BDF

2024-12-15 Thread Jason Chien
In order to distinguish which PCIe device sends the request over the IOMMU, the requester_id must be set with the BDF of the device. Signed-off-by: Jason Chien --- include/hw/pci/pci_device.h | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/include/hw/pci

[RFC PATCH 3/6] hw/pci-host: Enable DW PCIe host to send memory transactions over specific mr

2024-12-15 Thread Jason Chien
register PCIIOMMUOps.set_memory_region(), so an IOMMU can designate the downstream memory region for the PCIe devices. Signed-off-by: Jason Chien --- hw/pci-host/designware.c | 18 +++--- include/hw/pci-host/designware.h | 2 ++ 2 files changed, 17 insertions(+), 3 deletions

[RFC PATCH 4/6] hw/riscv/riscv-iommu: Allow PCI hosts with iommu_ops registered connecting to the IOMMU

2024-12-15 Thread Jason Chien
pci_setup_iommu_downstream_mem() is called to set the downstream memory region of the PCIe devices. Signed-off-by: Jason Chien --- hw/riscv/riscv-iommu.c | 8 1 file changed, 8 insertions(+) diff --git a/hw/riscv/riscv-iommu.c b/hw/riscv/riscv-iommu.c index e9a0775d6e..f5d53a36b2

[RFC PATCH 0/6] Avoid contention for PCIIOMMUOps between IOMMU and PCIe host

2024-12-15 Thread Jason Chien
, PCIIOMMUOps.set_memory_region(), and an API, pci_setup_iommu_downstream_mem, to avoid the contention for PCIIOMMUOps.get_address_space(). Jason Chien (6): include/hw/pci: Add a callback to set the downstream memory region of a pci bus hw/pci: Add an API to set the downstream memory region of a PCI bus hw/pci

[RFC PATCH 1/6] include/hw/pci: Add a callback to set the downstream memory region of a pci bus

2024-12-15 Thread Jason Chien
downstream memory region for the pci bus. Signed-off-by: Jason Chien --- include/hw/pci/pci.h | 13 + 1 file changed, 13 insertions(+) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index c0717e3121..cb3039bce8 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h

Re: [PATCH] hw/riscv/riscv-iommu.c: Introduce a translation tag for the page table cache

2024-11-25 Thread Jason Chien
Hi Tomasz, any thoughs? Daniel Henrique Barboza 於 2024年11月12日 週二 下午8:26寫道: > > CCing Tomasz > > On 11/8/24 8:01 AM, Jason Chien wrote: > > This commit introduces a translation tag to avoid invalidating an entry > > that should not be invalidated when IOMMU execut

[PATCH v2] hw/riscv/riscv-iommu.c: Correct the validness check of iova

2024-11-13 Thread Jason Chien
adds the iova check with the following rules: - For Sv32, Sv32x4, Sv39x4, Sv48x4 and Sv57x4, the iova must be zero extended. - For Sv39, Sv48 and Sv57, the iova must be signed extended with most significant bit. Signed-off-by: Jason Chien Reviewed-by: Daniel Henrique Barboza ---

[PATCH] hw/riscv/riscv-iommu.c: Introduce a translation tag for the page table cache

2024-11-08 Thread Jason Chien
, but only the former one should be invalidated. Signed-off-by: Jason Chien --- hw/riscv/riscv-iommu.c | 205 ++--- 1 file changed, 153 insertions(+), 52 deletions(-) diff --git a/hw/riscv/riscv-iommu.c b/hw/riscv/riscv-iommu.c index ff9deefe37..ac6bbf91d6

[PATCH 1/1] hw/riscv/riscv-iommu.c: Correct the validness check of iova

2024-11-08 Thread Jason Chien
iova check with the following rules: - For Sv32, Sv32x4, Sv39x4, Sv48x4 and Sv57x4, the iova must be zero extended. - For Sv39, Sv48 and Sv57, the iova must be signed extended with most significant bit. Signed-off-by: Jason Chien --- hw/riscv/riscv-iommu.c | 23 --- 1 file

Re: [PATCH v9 08/12] hw/riscv/riscv-iommu: add Address Translation Cache (IOATC)

2024-10-16 Thread Jason Chien
Hi Daniel, On 2024/10/4 下午 11:57, Daniel Henrique Barboza wrote: From: Tomasz Jeznach The RISC-V IOMMU spec predicts that the IOMMU can use translation caches to hold entries from the DDT. This includes implementation for all cache commands that are marked as 'not implemented'. There are some

Re: [PATCH v9 03/12] hw/riscv: add RISC-V IOMMU base emulation

2024-10-15 Thread Jason Chien
_MODE_3LVL) { +ok = old_mode == RISCV_IOMMU_DDTP_MODE_OFF || + old_mode == RISCV_IOMMU_DDTP_MODE_BARE; +} + +if (ok) { +/* clear reserved and busy bits, report back sanitized version */ +new_ddtp = set_field(new_ddtp & RISCV_IOMMU_DDTP_PPN,

Re: [PATCH for-9.2 v6 08/12] hw/riscv/riscv-iommu: add Address Translation Cache (IOATC)

2024-08-20 Thread Jason Chien
Hi Daniel, On 2024/8/1 下午 11:43, Daniel Henrique Barboza wrote: From: Tomasz Jeznach The RISC-V IOMMU spec predicts that the IOMMU can use translation caches to hold entries from the DDT. This includes implementation for all cache commands that are marked as 'not implemented'. There are some

Re: [PATCH for-9.2 v6 03/12] hw/riscv: add RISC-V IOMMU base emulation

2024-08-20 Thread Jason Chien
Hi Daniel, On 2024/8/1 下午 11:43, Daniel Henrique Barboza wrote: From: Tomasz Jeznach The RISC-V IOMMU specification is now ratified as-per the RISC-V international process. The latest frozen specifcation can be found at: https://github.com/riscv-non-isa/riscv-iommu/releases/download/v1.0/risc

Re: [PATCH for-9.2 v6 02/12] hw/riscv: add riscv-iommu-bits.h

2024-08-07 Thread Jason Chien
za Reviewed-by: Frank Chang Reviewed-by: Jason Chien --- hw/riscv/riscv-iommu-bits.h | 345 1 file changed, 345 insertions(+) create mode 100644 hw/riscv/riscv-iommu-bits.h diff --git a/hw/riscv/riscv-iommu-bits.h b/hw/riscv/riscv-iommu-bits.h new file mo

Re: [PATCH] target/riscv: Add a property to set vl to ceil(AVL/2)

2024-08-07 Thread Jason Chien
ping Jason Chien 於 2024年7月23日 週二 上午1:50寫道: > RVV spec allows implementations to set vl with values within > [ceil(AVL/2),VLMAX] when VLMAX < AVL < 2*VLMAX. This commit adds a > property "rvv_vl_half_avl" to enable setting vl = ceil(AVL/2). This > behavior helps ident

Re: [PATCH v5 11/13] hw/riscv/riscv-iommu: Add another irq for mrif notifications

2024-07-23 Thread Jason Chien
Hi Daniel, On 2024/7/9 上午 01:34, Daniel Henrique Barboza wrote: From: Andrew Jones And add mrif notification trace. Signed-off-by: Andrew Jones Reviewed-by: Daniel Henrique Barboza Reviewed-by: Frank Chang --- hw/riscv/riscv-iommu-pci.c | 2 +- hw/riscv/riscv-iommu.c | 1 + hw/risc

[PATCH] target/riscv: Add a property to set vl to ceil(AVL/2)

2024-07-22 Thread Jason Chien
RVV spec allows implementations to set vl with values within [ceil(AVL/2),VLMAX] when VLMAX < AVL < 2*VLMAX. This commit adds a property "rvv_vl_half_avl" to enable setting vl = ceil(AVL/2). This behavior helps identify compiler issues and bugs. Signed-off-by: Jason Chien --- ta

Re: [PATCH v5 05/13] hw/riscv: add riscv-iommu-pci reference device

2024-07-18 Thread Jason Chien
Hi Daniel, On 2024/7/9 上午 01:34, Daniel Henrique Barboza wrote: From: Tomasz Jeznach The RISC-V IOMMU can be modelled as a PCIe device following the guidelines of the RISC-V IOMMU spec, chapter 7.1, "Integrating an IOMMU as a PCIe device". Signed-off-by: Tomasz Jeznach Signed-off-by: Daniel

Re: [PATCH v4 03/14] hw/riscv: add RISC-V IOMMU base emulation

2024-07-04 Thread Jason Chien
Hi Danial, On 2024/6/25 上午 04:18, Daniel Henrique Barboza wrote: From: Tomasz Jeznach The RISC-V IOMMU specification is now ratified as-per the RISC-V international process. The latest frozen specifcation can be found at: https://github.com/riscv-non-isa/riscv-iommu/releases/download/v1.0/ris

Re: [PATCH v4 01/14] exec/memtxattr: add process identifier to the transaction attributes

2024-06-26 Thread Jason Chien
Reviewed-by: Jason Chien On 2024/6/25 上午 04:18, Daniel Henrique Barboza wrote: From: Tomasz Jeznach Extend memory transaction attributes with process identifier to allow per-request address translation logic to use requester_id / process_id to identify memory mapping (e.g. enabling IOMMU w

Re: [PATCH v2 0/6] target/riscv: Add support for Control Transfer Records Ext.

2024-06-25 Thread Jason Chien
Hi Rajnesh, On 2024/6/19 下午 11:27, Rajnesh Kanwal wrote: This series enables Control Transfer Records extension support on riscv platform. This extension is similar to Arch LBR in x86 and BRBE in ARM. The Extension has been stable and the latest release can be found here [0] CTR extension depen

Re: [PATCH v2 2/6] target/riscv: Add Control Transfer Records CSR definitions.

2024-06-25 Thread Jason Chien
Hi Rajnesh, On 2024/6/19 下午 11:27, Rajnesh Kanwal wrote: The Control Transfer Records (CTR) extension provides a method to record a limited branch history in register-accessible internal chip storage. This extension is similar to Arch LBR in x86 and BRBE in ARM. The Extension has been stable an

Re: [PATCH v2 4/6] target/riscv: Add support to record CTR entries.

2024-06-25 Thread Jason Chien
Hi Rajnesh, On 2024/6/19 下午 11:27, Rajnesh Kanwal wrote: This commit adds logic to records CTR entries of different types and adds required hooks in TCG and interrupt/Exception logic to record events. This commit also adds support to invoke freeze CTR logic for breakpoint exceptions and counter

Re: [PATCH v2 6/6] target/riscv: Add support to access ctrsource, ctrtarget, ctrdata regs.

2024-06-25 Thread Jason Chien
Hi Rajnesh, On 2024/6/19 下午 11:27, Rajnesh Kanwal wrote: CTR entries are accessed using ctrsource, ctrtarget and ctrdata registers using smcsrind/sscsrind extension. This commits extends the csrind extension to support CTR registers. ctrsource is accessible through xireg CSR, ctrtarget is acces

Re: [PATCH v2 5/6] target/riscv: Add CTR sctrclr instruction.

2024-06-25 Thread Jason Chien
Hi Rajnesh, On 2024/6/19 下午 11:27, Rajnesh Kanwal wrote: CTR extension adds a new instruction sctrclr to quickly clear the recorded entries buffer. Signed-off-by: Rajnesh Kanwal --- target/riscv/cpu.h| 1 + target/riscv/cpu_helper.c | 7

Re: [PATCH v2 3/6] target/riscv: Add support for Control Transfer Records extension CSRs.

2024-06-25 Thread Jason Chien
Hi Rajnesh, On 2024/6/19 下午 11:27, Rajnesh Kanwal wrote: This commit adds support for [m|s|vs]ctrcontrol, sctrstatus and sctrdepth CSRs handling. Signed-off-by: Rajnesh Kanwal --- target/riscv/cpu.h | 5 ++ target/riscv/cpu_cfg.h | 2 + target/riscv/csr.c | 128

Re: [PATCH v2 1/6] target/riscv: Remove obsolete sfence.vm instruction

2024-06-25 Thread Jason Chien
Reviewed-by: Jason Chien On 2024/6/19 下午 11:27, Rajnesh Kanwal wrote: Signed-off-by: Rajnesh Kanwal Reviewed-by: Alistair Francis --- target/riscv/insn32.decode | 1 - target/riscv/insn_trans/trans_privileged.c.inc | 5 - 2 files changed, 6 deletions(-) diff

Re: [PATCH v3 03/13] hw/riscv: add RISC-V IOMMU base emulation

2024-06-18 Thread Jason Chien
On 2024/6/18 下午 06:06, Jason Chien wrote: Hi Daniel, On 2024/5/24 上午 01:39, Daniel Henrique Barboza wrote: From: Tomasz Jeznach The RISC-V IOMMU specification is now ratified as-per the RISC-V international process. The latest frozen specifcation can be found at: https://github.com/riscv

Re: [PATCH v3 09/13] hw/riscv/riscv-iommu: add s-stage and g-stage support

2024-06-18 Thread Jason Chien
Hi Daniel, On 2024/5/24 上午 01:39, Daniel Henrique Barboza wrote: From: Tomasz Jeznach Add support for s-stage (sv32, sv39, sv48, sv57 caps) and g-stage (sv32x4, sv39x4, sv48x4, sv57x4 caps). Most of the work is done in the riscv_iommu_spa_fetch() function that now has to consider how many tran

Re: [PATCH v3 03/13] hw/riscv: add RISC-V IOMMU base emulation

2024-06-18 Thread Jason Chien
Hi Daniel, On 2024/5/24 上午 01:39, Daniel Henrique Barboza wrote: From: Tomasz Jeznach The RISC-V IOMMU specification is now ratified as-per the RISC-V international process. The latest frozen specifcation can be found at: https://github.com/riscv-non-isa/riscv-iommu/releases/download/v1.0/ris

Re: [PATCH 3/6] target/riscv: Add support for Control Transfer Records extension CSRs.

2024-06-11 Thread Jason Chien
It makes sense. Thank you for the explanation. Rajnesh Kanwal 於 2024年6月10日 週一 下午10:12寫道: > > Thanks Jason for your review. > > On Tue, Jun 4, 2024 at 11:14 AM Jason Chien > wrote: > > > > > > Rajnesh Kanwal 於 2024/5/30 上午 12:09 寫道: > > > > Th

Re: [PATCH v3 03/13] hw/riscv: add RISC-V IOMMU base emulation

2024-06-11 Thread Jason Chien
Hi Daniel, On 2024/5/24 上午 01:39, Daniel Henrique Barboza wrote: From: Tomasz Jeznach The RISC-V IOMMU specification is now ratified as-per the RISC-V international process. The latest frozen specifcation can be found at: https://github.com/riscv-non-isa/riscv-iommu/releases/download/v1.0/ris

Re: [PATCH RFC 4/8] target/riscv: Support generic CSR indirect access

2024-06-05 Thread Jason Chien
The predicate functions should contain the access control by the state-enable CSRs, which is not presented in this patch. Do you mind that I take over the indirect CSR access control part? The Signed-off-by will be kept. Atish Patra 於 2024/2/17 上午 08:01 寫道: From: Kaiwen Xue This adds the in

Re: [PATCH RFC 2/8] target/riscv: Decouple AIA processing from xiselect and xireg

2024-06-05 Thread Jason Chien
Atish Patra 於 2024/2/17 上午 08:01 寫道: From: Kaiwen Xue Since xiselect and xireg also will be of use in sxcsrind, AIA should have its own separated interface when those CSRs are accessed. Signed-off-by: Atish Patra Signed-off-by: Kaiwen Xue --- target/riscv/csr.c | 147

Re: [PATCH 5/6] target/riscv: Add CTR sctrclr instruction.

2024-06-04 Thread Jason Chien
correct? Thanks in advance. Beeman Strong 於 2024/6/5 上午 02:46 寫道: On Tue, Jun 4, 2024 at 10:19 AM Jason Chien wrote: Rajnesh Kanwal 於 2024/5/30 上午 12:09 寫道: > CTR extension adds a new instruction sctrclr to quickly > clear the recorded entries buffer. > &g

Re: [PATCH 0/6] target/riscv: Add support for Control Transfer Records Ext.

2024-06-04 Thread Jason Chien
depend upon implementation of S-mode. Beeman Strong 於 2024/6/5 上午 06:32 寫道: There is no dependency on Smcsrind, only Sscsrind. On Tue, Jun 4, 2024 at 12:29 AM Jason Chien wrote: Smctr depends on the Smcsrind extension, Ssctr depends on the Sscsrind extension, and both Smctr and

Re: [PATCH 5/6] target/riscv: Add CTR sctrclr instruction.

2024-06-04 Thread Jason Chien
Rajnesh Kanwal 於 2024/5/30 上午 12:09 寫道: CTR extension adds a new instruction sctrclr to quickly clear the recorded entries buffer. Signed-off-by: Rajnesh Kanwal --- target/riscv/cpu.h | 1 + target/riscv/cpu_helper.c | 7 +++ target/r

Re: [PATCH 6/6] target/riscv: Add support to access ctrsource, ctrtarget, ctrdata regs.

2024-06-04 Thread Jason Chien
Rajnesh Kanwal 於 2024/5/30 上午 12:09 寫道: CTR entries are accessed using ctrsource, ctrtarget and ctrdata registers using smcsrind/sscsrind extension. This commits extends the csrind extension to support CTR registers. ctrsource is accessible through xireg CSR, ctrtarget is accessible through xi

Re: [PATCH 4/6] target/riscv: Add support to record CTR entries.

2024-06-04 Thread Jason Chien
This commit is missing CTR for cm.jalt, cm.jt, cm.popret, cm.popretz. Rajnesh Kanwal 於 2024/5/30 上午 12:09 寫道: This commit adds logic to records CTR entries of different types and adds required hooks in TCG and interrupt/Exception logic to record events. This commit also adds support to invoke f

Re: [PATCH 3/6] target/riscv: Add support for Control Transfer Records extension CSRs.

2024-06-04 Thread Jason Chien
Rajnesh Kanwal 於 2024/5/30 上午 12:09 寫道: This commit adds support for [m|s|vs]ctrcontrol, sctrstatus and sctrdepth CSRs handling. Signed-off-by: Rajnesh Kanwal --- target/riscv/cpu.h | 5 ++ target/riscv/cpu_cfg.h | 2 + target/riscv/csr.c | 159 ++

Re: [PATCH 0/6] target/riscv: Add support for Control Transfer Records Ext.

2024-06-04 Thread Jason Chien
Smctr depends on the Smcsrind extension, Ssctr depends on the Sscsrind extension, and both Smctr and Ssctr depend upon implementation of S-mode. There should be a dependency check in riscv_cpu_validate_set_extensions(). Rajnesh Kanwal 於 2024/5/30 上午 12:09 寫道: This series enables Control Transfe

Re: [PATCH v2 03/15] hw/riscv: add RISC-V IOMMU base emulation

2024-05-01 Thread Jason Chien
Daniel Henrique Barboza 於 2024/3/8 上午 12:03 寫道: From: Tomasz Jeznach The RISC-V IOMMU specification is now ratified as-per the RISC-V international process. The latest frozen specifcation can be found at: https://github.com/riscv-non-isa/riscv-iommu/releases/download/v1.0/riscv-iommu.pdf Add t

Re: [PATCH v3 3/3] target/riscv: Relax vector register check in RISCV gdbstub

2024-04-08 Thread Jason Chien
Ping. Jason Chien 於 2024年3月28日 週四 上午10:24寫道: > In current implementation, the gdbstub allows reading vector registers > only if V extension is supported. However, all vector extensions and > vector crypto extensions have the vector registers and they all depend > on Zve32x. The gd

Re: [PATCH v3 0/3] target/riscv: Support Zve32x and Zve64x extensions

2024-04-08 Thread Jason Chien
Ping. Jason Chien 於 2024年3月28日 週四 上午10:23寫道: > This patch series adds the support for Zve32x and Zvx64x and makes vector > registers visible in GDB if any of the V/Zve*/Zvk* extensions is enabled. > > v2: > Rebase onto riscv-to-apply.next (commit 385e575). > v3: >

[PATCH v3 1/3] target/riscv: Add support for Zve32x extension

2024-03-27 Thread Jason Chien
Add support for Zve32x extension and replace some checks for Zve32f with Zve32x, since Zve32f depends on Zve32x. Signed-off-by: Jason Chien Reviewed-by: Frank Chang Reviewed-by: Max Chou Reviewed-by: Daniel Henrique Barboza --- target/riscv/cpu.c | 2 ++ target/riscv

[PATCH v3 2/3] target/riscv: Add support for Zve64x extension

2024-03-27 Thread Jason Chien
Add support for Zve64x extension. Enabling Zve64f enables Zve64x and enabling Zve64x enables Zve32x according to their dependency. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2107 Signed-off-by: Jason Chien Reviewed-by: Frank Chang Reviewed-by: Max Chou Reviewed-by: Daniel Henrique

[PATCH v3 3/3] target/riscv: Relax vector register check in RISCV gdbstub

2024-03-27 Thread Jason Chien
In current implementation, the gdbstub allows reading vector registers only if V extension is supported. However, all vector extensions and vector crypto extensions have the vector registers and they all depend on Zve32x. The gdbstub should check for Zve32x instead. Signed-off-by: Jason Chien

[PATCH v3 0/3] target/riscv: Support Zve32x and Zve64x extensions

2024-03-27 Thread Jason Chien
This patch series adds the support for Zve32x and Zvx64x and makes vector registers visible in GDB if any of the V/Zve*/Zvk* extensions is enabled. v2: Rebase onto riscv-to-apply.next (commit 385e575). v3: Spuash patch 2 into patch 1. Spuash patch 4 into patch 3. Jason Chien (3

[PATCH v2 1/5] target/riscv: Add support for Zve32x extension

2024-03-25 Thread Jason Chien
Add support for Zve32x extension and replace some checks for Zve32f with Zve32x, since Zve32f depends on Zve32x. Signed-off-by: Jason Chien Reviewed-by: Frank Chang Reviewed-by: Max Chou --- target/riscv/cpu.c | 1 + target/riscv/cpu_cfg.h | 1 + target

[PATCH v2 4/5] target/riscv: Expose Zve64x extension to users

2024-03-25 Thread Jason Chien
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2107 Signed-off-by: Jason Chien Reviewed-by: Frank Chang Reviewed-by: Max Chou --- target/riscv/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index f6287bf892..18e1ae66f4 100644 --- a

[PATCH v2 2/5] target/riscv: Expose Zve32x extension to users

2024-03-25 Thread Jason Chien
Signed-off-by: Jason Chien Reviewed-by: Frank Chang Reviewed-by: Max Chou --- target/riscv/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 851ac7372c..6bd8798bb5 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1473,6 +1473,7

[PATCH v2 5/5] target/riscv: Relax vector register check in RISCV gdbstub

2024-03-25 Thread Jason Chien
In current implementation, the gdbstub allows reading vector registers only if V extension is supported. However, all vector extensions and vector crypto extensions have the vector registers and they all depend on Zve32x. The gdbstub should check for Zve32x instead. Signed-off-by: Jason Chien

[PATCH v2 3/5] target/riscv: Add support for Zve64x extension

2024-03-25 Thread Jason Chien
Add support for Zve64x extension. Enabling Zve64f enables Zve64x and enabling Zve64x enables Zve32x according to their dependency. Signed-off-by: Jason Chien Reviewed-by: Frank Chang Reviewed-by: Max Chou --- target/riscv/cpu.c | 1 + target/riscv/cpu_cfg.h | 1 + target/riscv

[PATCH v2 0/5] target/riscv: Support Zve32x and Zve64x extensions

2024-03-25 Thread Jason Chien
This patch series adds the support for Zve32x and Zvx64x and makes vector registers visible in GDB if any of the V/Zve*/Zvk* extensions is enabled. v2: Rebase onto riscv-to-apply.next (commit 385e575). Jason Chien (5): target/riscv: Add support for Zve32x extension target/riscv: Expose

Re: [PATCH 1/5] target/riscv: Add support for Zve32x extension

2024-03-21 Thread Jason Chien
I will re-send shortly. Thanks. Daniel Henrique Barboza 於 2024年3月20日 週三 上午5:19寫道: > Hi Jason, > > Care to re-send please? The patches don't apply to neither > riscv-to-apply.next > nor master. > > > Thanks, > > Daniel > > On 3/19/24 13:23, Jason Chi

Re: [PATCH 1/5] target/riscv: Add support for Zve32x extension

2024-03-19 Thread Jason Chien
Ping. Can anyone review the patches please? Jason Chien 於 2024年3月7日 週四 上午1:09寫道: > Add support for Zve32x extension and replace some checks for Zve32f with > Zve32x, since Zve32f depends on Zve32x. > > Signed-off-by: Jason Chien > Reviewed-by: Frank Chang > Rev

Re: [PATCH 0/5] target/riscv: Support Zve32x and Zve64x extensions

2024-03-19 Thread Jason Chien
Ping. Can anyone review the patches please? Jason Chien 於 2024年3月7日 週四 上午1:09寫道: > This patch series adds the support for Zve32x and Zvx64x and makes vector > registers visible in GDB if any of the V/Zve*/Zvk* extensions is enabled. > > Jason Chien (5): > target/riscv: Add sup

[PATCH 3/5] target/riscv: Add support for Zve64x extension

2024-03-06 Thread Jason Chien
Add support for Zve64x extension. Enabling Zve64f enables Zve64x and enabling Zve64x enables Zve32x according to their dependency. Signed-off-by: Jason Chien Reviewed-by: Frank Chang Reviewed-by: Max Chou --- target/riscv/cpu.c | 1 + target/riscv/cpu_cfg.h | 1 + target/riscv

[PATCH 1/5] target/riscv: Add support for Zve32x extension

2024-03-06 Thread Jason Chien
Add support for Zve32x extension and replace some checks for Zve32f with Zve32x, since Zve32f depends on Zve32x. Signed-off-by: Jason Chien Reviewed-by: Frank Chang Reviewed-by: Max Chou --- target/riscv/cpu.c | 1 + target/riscv/cpu_cfg.h | 1 + target

[PATCH 2/5] target/riscv: Expose Zve32x extension to users

2024-03-06 Thread Jason Chien
Signed-off-by: Jason Chien Reviewed-by: Frank Chang Reviewed-by: Max Chou --- target/riscv/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 10ccae3323..37e4557b47 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1469,6 +1469,7

[PATCH 4/5] target/riscv: Expose Zve64x extension to users

2024-03-06 Thread Jason Chien
Signed-off-by: Jason Chien Reviewed-by: Frank Chang Reviewed-by: Max Chou --- target/riscv/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 8b5d1eb6a8..58b2a94694 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1473,6 +1473,7

[PATCH 5/5] target/riscv: Relax vector register check in RISCV gdbstub

2024-03-06 Thread Jason Chien
In current implementation, the gdbstub allows reading vector registers only if V extension is supported. However, all vector extensions and vector crypto extensions have the vector registers and they all depend on Zve32x. The gdbstub should check for Zve32x instead. Signed-off-by: Jason Chien

[PATCH 0/5] target/riscv: Support Zve32x and Zve64x extensions

2024-03-06 Thread Jason Chien
This patch series adds the support for Zve32x and Zvx64x and makes vector registers visible in GDB if any of the V/Zve*/Zvk* extensions is enabled. Jason Chien (5): target/riscv: Add support for Zve32x extension target/riscv: Expose Zve32x extension to users target/riscv: Add support for

[PATCH v2] target/riscv: Update $ra with current $pc in trans_cm_jalt()

2024-02-07 Thread Jason Chien
currently executing, which results in an infinite loop. This commit stores the jump address in a temporary, updates $ra with the current $pc, and copies the temporary to $pc. Signed-off-by: Jason Chien Reviewed-by: Frank Chang --- target/riscv/insn_trans/trans_rvzce.c.inc | 6 +- 1 file

Re: [PATCH] target/riscv: Update $pc after linking to $ra in trans_cm_jalt()

2024-02-06 Thread Jason Chien
You are right. I'll send patch v2 shortly. Thank you for the reply. Richard Henderson 於 2024年2月7日 週三 上午4:24寫道: > On 2/6/24 23:18, Jason Chien wrote: > > The original implementation sets $pc to the address read from the jump > > vector table first and links $ra with the

[PATCH] target/riscv: Update $pc after linking to $ra in trans_cm_jalt()

2024-02-06 Thread Jason Chien
currently executing, which results in an infinite loop. This commit reverses the two action. Firstly, $ra is updated with the address of the next instruction after $pc, and sets $pc to the address read from the jump vector table. Signed-off-by: Jason Chien --- target/riscv/insn_trans

Re: [PATCH 2/2] hw/intc: Make rtc variable names consistent

2023-08-23 Thread Jason Chien
Thanks for the update. On Tue, Aug 22, 2023 at 1:53 AM Alistair Francis wrote: > On Mon, Aug 21, 2023 at 12:15 PM Jason Chien > wrote: > > > > Ping. > > This has been applied to the RISC-V tree. It will go in after the QEMU > release freeze is over (probably a

Re: [PATCH 2/2] hw/intc: Make rtc variable names consistent

2023-08-21 Thread Jason Chien
Ping. On Fri, Aug 11, 2023 at 2:25 AM Alistair Francis wrote: > On Fri, Jul 28, 2023 at 4:57 AM Jason Chien > wrote: > > > > The variables whose values are given by cpu_riscv_read_rtc() should be > named > > "rtc". The variables whose value are given by c

  1   2   >