spapr: tune rtas-size
PATCH 1/1 spapr: tune rtas-size
QEMU reserves space for RTAS via /rtas/rtas-size which tells the client how much space the RTAS requires to work which includes the RTAS binary blob implementing RTAS runtime. Because pseries supports FWNMI which requires plenty of space, QEMU reserves more than 2KB which is enough for the RTAS blob as it is just 20 bytes (under QEMU).
Since FWNMI reset delivery was added, RTAS_SIZE macro is not used anymore. This replaces RTAS_SIZE with RTAS_MIN_SIZE and uses it in
the /rtas/rtas-size calculation to account for the RTAS blob.
---
Alternatively SLOF could add hv_rtas_size to the property itself but splitting calculations between 2 chunks of code seems an overkill. The RTAS blob has always been 20 bytes and unlikely to ever change.
--- include/hw/ppc/spapr.h | 2 +- hw/ppc/spapr.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-)
include/hw/ppc/spapr.h +1 -1
@@ -770,7 +770,7 @@ void spapr_load_rtas(SpaprMachineState *spapr, void *fdt, hwaddr addr);#define SPAPR_IS_PCI_LIOBN (liobn) (!!((liobn) & 0x80000000))#define SPAPR_PCI_DMA_WINDOW_NUM (liobn) ((liobn) & 0xff) -#define RTAS_SIZE 2048 +#define RTAS_MIN_SIZE 20/* hv_rtas_size in SLOF */ #define RTAS_ERROR_LOG_MAX 2048/* Offset from rtas-base where error log is placed */
hw/ppc/spapr.c +6 -2
@@ -919,9 +919,13 @@ static void spapr_dt_rtas(SpaprMachineState *spapr, void *fdt)* * The extra 8 bytes is required because Linux's FWNMI error log check * is off-by-one. +* +* RTAS_MIN_SIZE is required for the RTAS blob itself. */ -_FDT (fdt_setprop_cell (fdt, rtas,"rtas-size" ,RTAS_ERROR_LOG_MAX + - ms->smp.max_cpus *sizeof (uint64_t )*2 +sizeof (uint64_t ))); +_FDT (fdt_setprop_cell (fdt, rtas,"rtas-size" ,RTAS_MIN_SIZE + +RTAS_ERROR_LOG_MAX + + ms->smp.max_cpus *sizeof (uint64_t ) *2 + +sizeof (uint64_t )));_FDT (fdt_setprop_cell (fdt, rtas,"rtas-error-log-max" ,RTAS_ERROR_LOG_MAX )); _FDT(fdt_setprop_cell(fdt, rtas, "rtas-event-scan-rate",
Signature · 1 line
2.30.2
Quoted 10 lines · On Tue, 22 Jun 2021 17:03:36 +1000 Alexey Kardashevskiy <[email protected]> wrote:
QEMU reserves space for RTAS via /rtas/rtas-size which tells the client how much space the RTAS requires to work which includes the RTAS binary blob implementing RTAS runtime. Because pseries supports FWNMI which requires plenty of space, QEMU reserves more than 2KB which is enough for the RTAS blob as it is just 20 bytes (under QEMU).
Since FWNMI reset delivery was added,
RTAS_SIZEmacro is not used anymore. This replacesRTAS_SIZEwithRTAS_MIN_SIZEand uses it in
the /rtas/rtas-size calculation to account for the RTAS blob.
Quoted 7 lines
Fixes 0e236d347790 ("ppc/spapr: Implement FWNMI System Reset delivery")Signed-off-by Alexey Kardashevskiy <[email protected]>---
Alternatively SLOF could add
hv_rtas_sizeto the property itself but splitting calculations between 2 chunks of code seems an overkill. The RTAS blob has always been 20 bytes and unlikely to ever change.
I guess this is acceptable.
Quoted 38 lines
--- include/hw/ppc/spapr.h | 2 +- hw/ppc/spapr.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-)include/hw/ppc/spapr.h +1
-1@@ -770,7 +770,7 @@ void spapr_load_rtas(SpaprMachineState *spapr, void *fdt, hwaddr addr);#define SPAPR_IS_PCI_LIOBN (liobn) (!!((liobn) & 0x80000000))#define SPAPR_PCI_DMA_WINDOW_NUM (liobn) ((liobn) & 0xff) -#define RTAS_SIZE 2048 +#define RTAS_MIN_SIZE 20/* hv_rtas_size in SLOF */ #define RTAS_ERROR_LOG_MAX 2048/* Offset from rtas-base where error log is placed */ hw/ppc/spapr.c +6
-2@@ -919,9 +919,13 @@ static void spapr_dt_rtas(SpaprMachineState *spapr, void *fdt)* * The extra 8 bytes is required because Linux's FWNMI error log check * is off-by-one. +* +* RTAS_MIN_SIZE is required for the RTAS blob itself. */ -_FDT (fdt_setprop_cell (fdt, rtas,"rtas-size" ,RTAS_ERROR_LOG_MAX + - ms->smp.max_cpus *sizeof (uint64_t )*2 +sizeof (uint64_t ))); +_FDT (fdt_setprop_cell (fdt, rtas,"rtas-size" ,RTAS_MIN_SIZE + +RTAS_ERROR_LOG_MAX + + ms->smp.max_cpus *sizeof (uint64_t ) *2 + +sizeof (uint64_t )));_FDT (fdt_setprop_cell (fdt, rtas,"rtas-error-log-max" ,RTAS_ERROR_LOG_MAX )); _FDT(fdt_setprop_cell(fdt, rtas, "rtas-event-scan-rate",
David Gibson
AppliedQuoted 6 lines · Alexey Kardashevskiy
QEMU reserves space for RTAS via /rtas/rtas-size which tells the client how much space the RTAS requires to work which includes the RTAS binary blob implementing RTAS runtime. Because pseries supports FWNMI which requires plenty of space, QEMU reserves more than 2KB which is enough for the RTAS blob as it is just 20 bytes (under QEMU).
Quoted 6 lines
Since FWNMI reset delivery was added,
RTAS_SIZEmacro is not used anymore. This replacesRTAS_SIZEwithRTAS_MIN_SIZEand uses it in
the /rtas/rtas-size calculation to account for the RTAS blob.Fixes 0e236d347790 ("ppc/spapr: Implement FWNMI System Reset delivery")Signed-off-by Alexey Kardashevskiy <[email protected]>
Applied to ppc-for-6.1, thanks.
Quoted 43 lines
---
Alternatively SLOF could add
hv_rtas_sizeto the property itself but splitting calculations between 2 chunks of code seems an overkill. The RTAS blob has always been 20 bytes and unlikely to ever change.--- include/hw/ppc/spapr.h | 2 +- hw/ppc/spapr.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-)include/hw/ppc/spapr.h +1
-1@@ -770,7 +770,7 @@ void spapr_load_rtas(SpaprMachineState *spapr, void *fdt, hwaddr addr);#define SPAPR_IS_PCI_LIOBN (liobn) (!!((liobn) & 0x80000000))#define SPAPR_PCI_DMA_WINDOW_NUM (liobn) ((liobn) & 0xff) -#define RTAS_SIZE 2048 +#define RTAS_MIN_SIZE 20/* hv_rtas_size in SLOF */ #define RTAS_ERROR_LOG_MAX 2048/* Offset from rtas-base where error log is placed */ hw/ppc/spapr.c +6
-2@@ -919,9 +919,13 @@ static void spapr_dt_rtas(SpaprMachineState *spapr, void *fdt)* * The extra 8 bytes is required because Linux's FWNMI error log check * is off-by-one. +* +* RTAS_MIN_SIZE is required for the RTAS blob itself. */ -_FDT (fdt_setprop_cell (fdt, rtas,"rtas-size" ,RTAS_ERROR_LOG_MAX + - ms->smp.max_cpus *sizeof (uint64_t )*2 +sizeof (uint64_t ))); +_FDT (fdt_setprop_cell (fdt, rtas,"rtas-size" ,RTAS_MIN_SIZE + +RTAS_ERROR_LOG_MAX + + ms->smp.max_cpus *sizeof (uint64_t ) *2 + +sizeof (uint64_t )));_FDT (fdt_setprop_cell (fdt, rtas,"rtas-error-log-max" ,RTAS_ERROR_LOG_MAX )); _FDT(fdt_setprop_cell(fdt, rtas, "rtas-event-scan-rate",
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson