All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Various xive fixes
@ 2023-06-01 12:13 Frederic Barrat
  2023-06-01 12:13 ` [PATCH v2 1/5] pnv/xive2: Add definition for TCTXT Config register Frederic Barrat
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Frederic Barrat @ 2023-06-01 12:13 UTC (permalink / raw)
  To: clg, danielhb413, qemu-ppc, qemu-devel

A set of small fixes for the interrupt controller (xive2) on P10.

Change log:
v2:
  split last patch to do a bit of cleanup first
  add Cedric's reviewed-by on the first 3 patches

Frederic Barrat (5):
  pnv/xive2: Add definition for TCTXT Config register
  pnv/xive2: Add definition for the ESB cache configuration register
  pnv/xive2: Allow writes to the Physical Thread Enable registers
  pnv/xive2: Introduce macros to manipulate TIMA addresses
  pnv/xive2: Handle TIMA access through all ports

 hw/intc/pnv_xive2.c        | 20 +++++++++++++++++++-
 hw/intc/pnv_xive2_regs.h   |  8 ++++++++
 hw/intc/xive.c             | 16 ++++++++--------
 include/hw/ppc/xive_regs.h | 16 ++++++++++++++++
 4 files changed, 51 insertions(+), 9 deletions(-)

-- 
2.40.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/5] pnv/xive2: Add definition for TCTXT Config register
  2023-06-01 12:13 [PATCH v2 0/5] Various xive fixes Frederic Barrat
@ 2023-06-01 12:13 ` Frederic Barrat
  2023-06-01 12:13 ` [PATCH v2 2/5] pnv/xive2: Add definition for the ESB cache configuration register Frederic Barrat
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Frederic Barrat @ 2023-06-01 12:13 UTC (permalink / raw)
  To: clg, danielhb413, qemu-ppc, qemu-devel

Add basic read/write support for the TCTXT Config register on P10. qemu
doesn't do anything with it yet, but it avoids logging a guest error
when skiboot configures the fused-core state:

qemu-system-ppc64 -machine powernv10 ... -d guest_errors
  ...
[    0.131670000,5] XIVE: [ IC 00  ] Initializing XIVE block ID 0...
XIVE[0] - TCTXT: invalid read @140
XIVE[0] - TCTXT: invalid write @140

Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
---
 hw/intc/pnv_xive2.c      | 8 +++++++-
 hw/intc/pnv_xive2_regs.h | 4 ++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c
index e688381536..f0817a124f 100644
--- a/hw/intc/pnv_xive2.c
+++ b/hw/intc/pnv_xive2.c
@@ -1269,6 +1269,9 @@ static uint64_t pnv_xive2_ic_tctxt_read(void *opaque, hwaddr offset,
     case TCTXT_EN1_RESET:
         val = xive->tctxt_regs[TCTXT_EN1 >> 3];
         break;
+    case TCTXT_CFG:
+        val = xive->tctxt_regs[reg];
+        break;
     default:
         xive2_error(xive, "TCTXT: invalid read @%"HWADDR_PRIx, offset);
     }
@@ -1280,6 +1283,7 @@ static void pnv_xive2_ic_tctxt_write(void *opaque, hwaddr offset,
                                      uint64_t val, unsigned size)
 {
     PnvXive2 *xive = PNV_XIVE2(opaque);
+    uint32_t reg = offset >> 3;
 
     switch (offset) {
     /*
@@ -1301,7 +1305,9 @@ static void pnv_xive2_ic_tctxt_write(void *opaque, hwaddr offset,
     case TCTXT_EN1_RESET:
         xive->tctxt_regs[TCTXT_EN1 >> 3] &= ~val;
         break;
-
+    case TCTXT_CFG:
+        xive->tctxt_regs[reg] = val;
+        break;
     default:
         xive2_error(xive, "TCTXT: invalid write @%"HWADDR_PRIx, offset);
         return;
diff --git a/hw/intc/pnv_xive2_regs.h b/hw/intc/pnv_xive2_regs.h
index 0c096e4adb..8f1e0a1fde 100644
--- a/hw/intc/pnv_xive2_regs.h
+++ b/hw/intc/pnv_xive2_regs.h
@@ -405,6 +405,10 @@
 #define X_TCTXT_EN1_RESET                       0x307
 #define TCTXT_EN1_RESET                         0x038
 
+/* TCTXT Config register */
+#define X_TCTXT_CFG                             0x328
+#define TCTXT_CFG                               0x140
+
 /*
  * VSD Tables
  */
-- 
2.40.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/5] pnv/xive2: Add definition for the ESB cache configuration register
  2023-06-01 12:13 [PATCH v2 0/5] Various xive fixes Frederic Barrat
  2023-06-01 12:13 ` [PATCH v2 1/5] pnv/xive2: Add definition for TCTXT Config register Frederic Barrat
@ 2023-06-01 12:13 ` Frederic Barrat
  2023-06-01 12:13 ` [PATCH v2 3/5] pnv/xive2: Allow writes to the Physical Thread Enable registers Frederic Barrat
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Frederic Barrat @ 2023-06-01 12:13 UTC (permalink / raw)
  To: clg, danielhb413, qemu-ppc, qemu-devel

Add basic read/write support for the ESB cache configuration register
on P10. We don't model the ESB cache in qemu so reading/writing the
register won't do anything, but it avoids logging a guest error when
skiboot configures it:

qemu-system-ppc64 -machine powernv10 ... -d guest_errors
      ...
XIVE[0] - VC: invalid read @240
XIVE[0] - VC: invalid write @240

Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
---
 hw/intc/pnv_xive2.c      | 7 +++++++
 hw/intc/pnv_xive2_regs.h | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c
index f0817a124f..9778c102ff 100644
--- a/hw/intc/pnv_xive2.c
+++ b/hw/intc/pnv_xive2.c
@@ -959,6 +959,10 @@ static uint64_t pnv_xive2_ic_vc_read(void *opaque, hwaddr offset,
         val = xive->vc_regs[reg];
         break;
 
+    case VC_ESBC_CFG:
+        val = xive->vc_regs[reg];
+        break;
+
     /*
      * EAS cache updates (not modeled)
      */
@@ -1050,6 +1054,9 @@ static void pnv_xive2_ic_vc_write(void *opaque, hwaddr offset,
         /* ESB update */
         break;
 
+    case VC_ESBC_CFG:
+        break;
+
     /*
      * EAS cache updates (not modeled)
      */
diff --git a/hw/intc/pnv_xive2_regs.h b/hw/intc/pnv_xive2_regs.h
index 8f1e0a1fde..7165dc8704 100644
--- a/hw/intc/pnv_xive2_regs.h
+++ b/hw/intc/pnv_xive2_regs.h
@@ -232,6 +232,10 @@
 #define  VC_ESBC_FLUSH_POLL_BLOCK_ID_MASK       PPC_BITMASK(32, 35)
 #define  VC_ESBC_FLUSH_POLL_OFFSET_MASK         PPC_BITMASK(36, 63) /* 28-bit */
 
+/* ESBC configuration */
+#define X_VC_ESBC_CFG                           0x148
+#define VC_ESBC_CFG                             0x240
+
 /* EASC flush control register */
 #define X_VC_EASC_FLUSH_CTRL                    0x160
 #define VC_EASC_FLUSH_CTRL                      0x300
-- 
2.40.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/5] pnv/xive2: Allow writes to the Physical Thread Enable registers
  2023-06-01 12:13 [PATCH v2 0/5] Various xive fixes Frederic Barrat
  2023-06-01 12:13 ` [PATCH v2 1/5] pnv/xive2: Add definition for TCTXT Config register Frederic Barrat
  2023-06-01 12:13 ` [PATCH v2 2/5] pnv/xive2: Add definition for the ESB cache configuration register Frederic Barrat
@ 2023-06-01 12:13 ` Frederic Barrat
  2023-06-01 12:13 ` [PATCH v2 4/5] pnv/xive2: Introduce macros to manipulate TIMA addresses Frederic Barrat
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Frederic Barrat @ 2023-06-01 12:13 UTC (permalink / raw)
  To: clg, danielhb413, qemu-ppc, qemu-devel

Fix what was probably a silly mistake and allow to write the Physical
Thread enable registers 0 and 1. Skiboot prefers to use the ENx_SET
variant so it went unnoticed, but there's no reason to discard a write
to the full register, it is Read-Write.

Fixes: da71b7e3ed45 ("ppc/pnv: Add a XIVE2 controller to the POWER10 chip")
Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
---
 hw/intc/pnv_xive2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c
index 9778c102ff..5fc4240216 100644
--- a/hw/intc/pnv_xive2.c
+++ b/hw/intc/pnv_xive2.c
@@ -1298,6 +1298,7 @@ static void pnv_xive2_ic_tctxt_write(void *opaque, hwaddr offset,
      */
     case TCTXT_EN0: /* Physical Thread Enable */
     case TCTXT_EN1: /* Physical Thread Enable (fused core) */
+        xive->tctxt_regs[reg] = val;
         break;
 
     case TCTXT_EN0_SET:
-- 
2.40.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 4/5] pnv/xive2: Introduce macros to manipulate TIMA addresses
  2023-06-01 12:13 [PATCH v2 0/5] Various xive fixes Frederic Barrat
                   ` (2 preceding siblings ...)
  2023-06-01 12:13 ` [PATCH v2 3/5] pnv/xive2: Allow writes to the Physical Thread Enable registers Frederic Barrat
@ 2023-06-01 12:13 ` Frederic Barrat
  2023-06-01 12:22   ` Cédric Le Goater
  2023-06-01 12:13 ` [PATCH v2 5/5] pnv/xive2: Handle TIMA access through all ports Frederic Barrat
  2023-06-01 20:30 ` [PATCH v2 0/5] Various xive fixes Daniel Henrique Barboza
  5 siblings, 1 reply; 9+ messages in thread
From: Frederic Barrat @ 2023-06-01 12:13 UTC (permalink / raw)
  To: clg, danielhb413, qemu-ppc, qemu-devel

TIMA addresses are somewhat special and are split in several bit
fields with different meanings. This patch describes it and introduce
macros to more easily access the various fields.

Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
---
 hw/intc/xive.c             | 14 +++++++-------
 include/hw/ppc/xive_regs.h | 16 ++++++++++++++++
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index a986b96843..ebe399bc09 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -249,7 +249,7 @@ static const uint8_t *xive_tm_views[] = {
 static uint64_t xive_tm_mask(hwaddr offset, unsigned size, bool write)
 {
     uint8_t page_offset = (offset >> TM_SHIFT) & 0x3;
-    uint8_t reg_offset = offset & 0x3F;
+    uint8_t reg_offset = offset & TM_REG_OFFSET;
     uint8_t reg_mask = write ? 0x1 : 0x2;
     uint64_t mask = 0x0;
     int i;
@@ -266,8 +266,8 @@ static uint64_t xive_tm_mask(hwaddr offset, unsigned size, bool write)
 static void xive_tm_raw_write(XiveTCTX *tctx, hwaddr offset, uint64_t value,
                               unsigned size)
 {
-    uint8_t ring_offset = offset & 0x30;
-    uint8_t reg_offset = offset & 0x3F;
+    uint8_t ring_offset = offset & TM_RING_OFFSET;
+    uint8_t reg_offset = offset & TM_REG_OFFSET;
     uint64_t mask = xive_tm_mask(offset, size, true);
     int i;
 
@@ -296,8 +296,8 @@ static void xive_tm_raw_write(XiveTCTX *tctx, hwaddr offset, uint64_t value,
 
 static uint64_t xive_tm_raw_read(XiveTCTX *tctx, hwaddr offset, unsigned size)
 {
-    uint8_t ring_offset = offset & 0x30;
-    uint8_t reg_offset = offset & 0x3F;
+    uint8_t ring_offset = offset & TM_RING_OFFSET;
+    uint8_t reg_offset = offset & TM_REG_OFFSET;
     uint64_t mask = xive_tm_mask(offset, size, false);
     uint64_t ret;
     int i;
@@ -534,7 +534,7 @@ void xive_tctx_tm_write(XivePresenter *xptr, XiveTCTX *tctx, hwaddr offset,
     /*
      * First, check for special operations in the 2K region
      */
-    if (offset & 0x800) {
+    if (offset & TM_SPECIAL_OP) {
         xto = xive_tm_find_op(offset, size, true);
         if (!xto) {
             qemu_log_mask(LOG_GUEST_ERROR, "XIVE: invalid write access at TIMA "
@@ -573,7 +573,7 @@ uint64_t xive_tctx_tm_read(XivePresenter *xptr, XiveTCTX *tctx, hwaddr offset,
     /*
      * First, check for special operations in the 2K region
      */
-    if (offset & 0x800) {
+    if (offset & TM_SPECIAL_OP) {
         xto = xive_tm_find_op(offset, size, false);
         if (!xto) {
             qemu_log_mask(LOG_GUEST_ERROR, "XIVE: invalid read access to TIMA"
diff --git a/include/hw/ppc/xive_regs.h b/include/hw/ppc/xive_regs.h
index b7fde2354e..4a3c9badd3 100644
--- a/include/hw/ppc/xive_regs.h
+++ b/include/hw/ppc/xive_regs.h
@@ -48,6 +48,22 @@
 
 #define TM_SHIFT                16
 
+/*
+ * TIMA addresses are 12-bits (4k page).
+ * The MSB indicates a special op with side effect, which can be
+ * refined with bit 10 (see below).
+ * The registers, logically grouped in 4 rings (a quad-word each), are
+ * defined on the 6 LSBs (offset below 0x40)
+ * In between, we can add a cache line index from 0...3 (ie, 0, 0x80,
+ * 0x100, 0x180) to select a specific snooper. Those 'snoop port
+ * address' bits should be dropped when processing the operations as
+ * they are all equivalent.
+ */
+#define TM_ADDRESS_MASK         0xC3F
+#define TM_SPECIAL_OP           0x800
+#define TM_RING_OFFSET          0x30
+#define TM_REG_OFFSET           0x3F
+
 /* TM register offsets */
 #define TM_QW0_USER             0x000 /* All rings */
 #define TM_QW1_OS               0x010 /* Ring 0..2 */
-- 
2.40.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 5/5] pnv/xive2: Handle TIMA access through all ports
  2023-06-01 12:13 [PATCH v2 0/5] Various xive fixes Frederic Barrat
                   ` (3 preceding siblings ...)
  2023-06-01 12:13 ` [PATCH v2 4/5] pnv/xive2: Introduce macros to manipulate TIMA addresses Frederic Barrat
@ 2023-06-01 12:13 ` Frederic Barrat
  2023-06-01 12:25   ` Cédric Le Goater
  2023-06-01 20:30 ` [PATCH v2 0/5] Various xive fixes Daniel Henrique Barboza
  5 siblings, 1 reply; 9+ messages in thread
From: Frederic Barrat @ 2023-06-01 12:13 UTC (permalink / raw)
  To: clg, danielhb413, qemu-ppc, qemu-devel

The Thread Interrupt Management Area (TIMA) can be accessed through 4
ports, targeted by the address. The base address of a TIMA
is using port 0 and the other ports are 0x80 apart. Using one port or
another can be useful to balance the load on the snoop buses. With
skiboot and linux, we currently use port 0, but as it tends to be
busy, another hypervisor is using port 1 for TIMA access.

The port address bits fall in between the special op indication
bits (the 2 MSBs) and the register offset bits (the 6 LSBs). They are
"don't care" for the hardware when processing a TIMA operation. This
patch filters out those port address bits so that a TIMA operation can
be triggered using any port.

It is also true for indirect access (through the IC BAR) and it's
actually nothing new, it was already the case on P9. Which helps here,
as the TIMA handling code is common between P9 (xive) and P10 (xive2).

Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
---
 hw/intc/pnv_xive2.c | 4 ++++
 hw/intc/xive.c      | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c
index 5fc4240216..ec1edeb385 100644
--- a/hw/intc/pnv_xive2.c
+++ b/hw/intc/pnv_xive2.c
@@ -1666,6 +1666,8 @@ static void pnv_xive2_tm_write(void *opaque, hwaddr offset,
     bool gen1_tima_os =
         xive->cq_regs[CQ_XIVE_CFG >> 3] & CQ_XIVE_CFG_GEN1_TIMA_OS;
 
+    offset &= TM_ADDRESS_MASK;
+
     /* TODO: should we switch the TM ops table instead ? */
     if (!gen1_tima_os && offset == HV_PUSH_OS_CTX_OFFSET) {
         xive2_tm_push_os_ctx(xptr, tctx, offset, value, size);
@@ -1685,6 +1687,8 @@ static uint64_t pnv_xive2_tm_read(void *opaque, hwaddr offset, unsigned size)
     bool gen1_tima_os =
         xive->cq_regs[CQ_XIVE_CFG >> 3] & CQ_XIVE_CFG_GEN1_TIMA_OS;
 
+    offset &= TM_ADDRESS_MASK;
+
     /* TODO: should we switch the TM ops table instead ? */
     if (!gen1_tima_os && offset == HV_PULL_OS_CTX_OFFSET) {
         return xive2_tm_pull_os_ctx(xptr, tctx, offset, size);
diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index ebe399bc09..5204c14b87 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -500,7 +500,7 @@ static const XiveTmOp xive_tm_operations[] = {
 static const XiveTmOp *xive_tm_find_op(hwaddr offset, unsigned size, bool write)
 {
     uint8_t page_offset = (offset >> TM_SHIFT) & 0x3;
-    uint32_t op_offset = offset & 0xFFF;
+    uint32_t op_offset = offset & TM_ADDRESS_MASK;
     int i;
 
     for (i = 0; i < ARRAY_SIZE(xive_tm_operations); i++) {
-- 
2.40.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 4/5] pnv/xive2: Introduce macros to manipulate TIMA addresses
  2023-06-01 12:13 ` [PATCH v2 4/5] pnv/xive2: Introduce macros to manipulate TIMA addresses Frederic Barrat
@ 2023-06-01 12:22   ` Cédric Le Goater
  0 siblings, 0 replies; 9+ messages in thread
From: Cédric Le Goater @ 2023-06-01 12:22 UTC (permalink / raw)
  To: Frederic Barrat, danielhb413, qemu-ppc, qemu-devel

On 6/1/23 14:13, Frederic Barrat wrote:
> TIMA addresses are somewhat special and are split in several bit
> fields with different meanings. This patch describes it and introduce
> macros to more easily access the various fields.
> 
> Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>


Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.


> ---
>   hw/intc/xive.c             | 14 +++++++-------
>   include/hw/ppc/xive_regs.h | 16 ++++++++++++++++
>   2 files changed, 23 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/intc/xive.c b/hw/intc/xive.c
> index a986b96843..ebe399bc09 100644
> --- a/hw/intc/xive.c
> +++ b/hw/intc/xive.c
> @@ -249,7 +249,7 @@ static const uint8_t *xive_tm_views[] = {
>   static uint64_t xive_tm_mask(hwaddr offset, unsigned size, bool write)
>   {
>       uint8_t page_offset = (offset >> TM_SHIFT) & 0x3;
> -    uint8_t reg_offset = offset & 0x3F;
> +    uint8_t reg_offset = offset & TM_REG_OFFSET;
>       uint8_t reg_mask = write ? 0x1 : 0x2;
>       uint64_t mask = 0x0;
>       int i;
> @@ -266,8 +266,8 @@ static uint64_t xive_tm_mask(hwaddr offset, unsigned size, bool write)
>   static void xive_tm_raw_write(XiveTCTX *tctx, hwaddr offset, uint64_t value,
>                                 unsigned size)
>   {
> -    uint8_t ring_offset = offset & 0x30;
> -    uint8_t reg_offset = offset & 0x3F;
> +    uint8_t ring_offset = offset & TM_RING_OFFSET;
> +    uint8_t reg_offset = offset & TM_REG_OFFSET;
>       uint64_t mask = xive_tm_mask(offset, size, true);
>       int i;
>   
> @@ -296,8 +296,8 @@ static void xive_tm_raw_write(XiveTCTX *tctx, hwaddr offset, uint64_t value,
>   
>   static uint64_t xive_tm_raw_read(XiveTCTX *tctx, hwaddr offset, unsigned size)
>   {
> -    uint8_t ring_offset = offset & 0x30;
> -    uint8_t reg_offset = offset & 0x3F;
> +    uint8_t ring_offset = offset & TM_RING_OFFSET;
> +    uint8_t reg_offset = offset & TM_REG_OFFSET;
>       uint64_t mask = xive_tm_mask(offset, size, false);
>       uint64_t ret;
>       int i;
> @@ -534,7 +534,7 @@ void xive_tctx_tm_write(XivePresenter *xptr, XiveTCTX *tctx, hwaddr offset,
>       /*
>        * First, check for special operations in the 2K region
>        */
> -    if (offset & 0x800) {
> +    if (offset & TM_SPECIAL_OP) {
>           xto = xive_tm_find_op(offset, size, true);
>           if (!xto) {
>               qemu_log_mask(LOG_GUEST_ERROR, "XIVE: invalid write access at TIMA "
> @@ -573,7 +573,7 @@ uint64_t xive_tctx_tm_read(XivePresenter *xptr, XiveTCTX *tctx, hwaddr offset,
>       /*
>        * First, check for special operations in the 2K region
>        */
> -    if (offset & 0x800) {
> +    if (offset & TM_SPECIAL_OP) {
>           xto = xive_tm_find_op(offset, size, false);
>           if (!xto) {
>               qemu_log_mask(LOG_GUEST_ERROR, "XIVE: invalid read access to TIMA"
> diff --git a/include/hw/ppc/xive_regs.h b/include/hw/ppc/xive_regs.h
> index b7fde2354e..4a3c9badd3 100644
> --- a/include/hw/ppc/xive_regs.h
> +++ b/include/hw/ppc/xive_regs.h
> @@ -48,6 +48,22 @@
>   
>   #define TM_SHIFT                16
>   
> +/*
> + * TIMA addresses are 12-bits (4k page).
> + * The MSB indicates a special op with side effect, which can be
> + * refined with bit 10 (see below).
> + * The registers, logically grouped in 4 rings (a quad-word each), are
> + * defined on the 6 LSBs (offset below 0x40)
> + * In between, we can add a cache line index from 0...3 (ie, 0, 0x80,
> + * 0x100, 0x180) to select a specific snooper. Those 'snoop port
> + * address' bits should be dropped when processing the operations as
> + * they are all equivalent.
> + */
> +#define TM_ADDRESS_MASK         0xC3F
> +#define TM_SPECIAL_OP           0x800
> +#define TM_RING_OFFSET          0x30
> +#define TM_REG_OFFSET           0x3F
> +
>   /* TM register offsets */
>   #define TM_QW0_USER             0x000 /* All rings */
>   #define TM_QW1_OS               0x010 /* Ring 0..2 */



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 5/5] pnv/xive2: Handle TIMA access through all ports
  2023-06-01 12:13 ` [PATCH v2 5/5] pnv/xive2: Handle TIMA access through all ports Frederic Barrat
@ 2023-06-01 12:25   ` Cédric Le Goater
  0 siblings, 0 replies; 9+ messages in thread
From: Cédric Le Goater @ 2023-06-01 12:25 UTC (permalink / raw)
  To: Frederic Barrat, danielhb413, qemu-ppc, qemu-devel

On 6/1/23 14:13, Frederic Barrat wrote:
> The Thread Interrupt Management Area (TIMA) can be accessed through 4
> ports, targeted by the address. The base address of a TIMA
> is using port 0 and the other ports are 0x80 apart. Using one port or
> another can be useful to balance the load on the snoop buses. With
> skiboot and linux, we currently use port 0, but as it tends to be
> busy, another hypervisor is using port 1 for TIMA access.
> 
> The port address bits fall in between the special op indication
> bits (the 2 MSBs) and the register offset bits (the 6 LSBs). They are
> "don't care" for the hardware when processing a TIMA operation. This
> patch filters out those port address bits so that a TIMA operation can
> be triggered using any port.
> 
> It is also true for indirect access (through the IC BAR) and it's
> actually nothing new, it was already the case on P9. Which helps here,
> as the TIMA handling code is common between P9 (xive) and P10 (xive2).
> 
> Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>



Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.


> ---
>   hw/intc/pnv_xive2.c | 4 ++++
>   hw/intc/xive.c      | 2 +-
>   2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c
> index 5fc4240216..ec1edeb385 100644
> --- a/hw/intc/pnv_xive2.c
> +++ b/hw/intc/pnv_xive2.c
> @@ -1666,6 +1666,8 @@ static void pnv_xive2_tm_write(void *opaque, hwaddr offset,
>       bool gen1_tima_os =
>           xive->cq_regs[CQ_XIVE_CFG >> 3] & CQ_XIVE_CFG_GEN1_TIMA_OS;
>   
> +    offset &= TM_ADDRESS_MASK;
> +
>       /* TODO: should we switch the TM ops table instead ? */
>       if (!gen1_tima_os && offset == HV_PUSH_OS_CTX_OFFSET) {
>           xive2_tm_push_os_ctx(xptr, tctx, offset, value, size);
> @@ -1685,6 +1687,8 @@ static uint64_t pnv_xive2_tm_read(void *opaque, hwaddr offset, unsigned size)
>       bool gen1_tima_os =
>           xive->cq_regs[CQ_XIVE_CFG >> 3] & CQ_XIVE_CFG_GEN1_TIMA_OS;
>   
> +    offset &= TM_ADDRESS_MASK;
> +
>       /* TODO: should we switch the TM ops table instead ? */
>       if (!gen1_tima_os && offset == HV_PULL_OS_CTX_OFFSET) {
>           return xive2_tm_pull_os_ctx(xptr, tctx, offset, size);
> diff --git a/hw/intc/xive.c b/hw/intc/xive.c
> index ebe399bc09..5204c14b87 100644
> --- a/hw/intc/xive.c
> +++ b/hw/intc/xive.c
> @@ -500,7 +500,7 @@ static const XiveTmOp xive_tm_operations[] = {
>   static const XiveTmOp *xive_tm_find_op(hwaddr offset, unsigned size, bool write)
>   {
>       uint8_t page_offset = (offset >> TM_SHIFT) & 0x3;
> -    uint32_t op_offset = offset & 0xFFF;
> +    uint32_t op_offset = offset & TM_ADDRESS_MASK;
>       int i;
>   
>       for (i = 0; i < ARRAY_SIZE(xive_tm_operations); i++) {



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 0/5] Various xive fixes
  2023-06-01 12:13 [PATCH v2 0/5] Various xive fixes Frederic Barrat
                   ` (4 preceding siblings ...)
  2023-06-01 12:13 ` [PATCH v2 5/5] pnv/xive2: Handle TIMA access through all ports Frederic Barrat
@ 2023-06-01 20:30 ` Daniel Henrique Barboza
  5 siblings, 0 replies; 9+ messages in thread
From: Daniel Henrique Barboza @ 2023-06-01 20:30 UTC (permalink / raw)
  To: Frederic Barrat, clg, qemu-ppc, qemu-devel

Queued in gitlab.com/danielhb/qemu/tree/ppc-next. Thanks,


Daniel

On 6/1/23 09:13, Frederic Barrat wrote:
> A set of small fixes for the interrupt controller (xive2) on P10.
> 
> Change log:
> v2:
>    split last patch to do a bit of cleanup first
>    add Cedric's reviewed-by on the first 3 patches
> 
> Frederic Barrat (5):
>    pnv/xive2: Add definition for TCTXT Config register
>    pnv/xive2: Add definition for the ESB cache configuration register
>    pnv/xive2: Allow writes to the Physical Thread Enable registers
>    pnv/xive2: Introduce macros to manipulate TIMA addresses
>    pnv/xive2: Handle TIMA access through all ports
> 
>   hw/intc/pnv_xive2.c        | 20 +++++++++++++++++++-
>   hw/intc/pnv_xive2_regs.h   |  8 ++++++++
>   hw/intc/xive.c             | 16 ++++++++--------
>   include/hw/ppc/xive_regs.h | 16 ++++++++++++++++
>   4 files changed, 51 insertions(+), 9 deletions(-)
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-06-01 20:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-01 12:13 [PATCH v2 0/5] Various xive fixes Frederic Barrat
2023-06-01 12:13 ` [PATCH v2 1/5] pnv/xive2: Add definition for TCTXT Config register Frederic Barrat
2023-06-01 12:13 ` [PATCH v2 2/5] pnv/xive2: Add definition for the ESB cache configuration register Frederic Barrat
2023-06-01 12:13 ` [PATCH v2 3/5] pnv/xive2: Allow writes to the Physical Thread Enable registers Frederic Barrat
2023-06-01 12:13 ` [PATCH v2 4/5] pnv/xive2: Introduce macros to manipulate TIMA addresses Frederic Barrat
2023-06-01 12:22   ` Cédric Le Goater
2023-06-01 12:13 ` [PATCH v2 5/5] pnv/xive2: Handle TIMA access through all ports Frederic Barrat
2023-06-01 12:25   ` Cédric Le Goater
2023-06-01 20:30 ` [PATCH v2 0/5] Various xive fixes Daniel Henrique Barboza

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.