Skip to contentSkip to conversation

target-arm queue

GIT PULL Applied Peter Maydell 5 participants 27 messages Sep 13, 2019 – Jul 12, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

target-arm queue: mostly aspeed changes from Cédric.

thanks
-- PMM

The following changes since commit 85182c96de61f0b600bbe834d5a23e713162e892:

Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20190912a' into staging (2019-09-13 14:37:48 +0100)

are available in the Git repository at:

https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190913

for you to fetch changes up to 27a296fce9821e3608d537756cffa6e43a46df3b:

qemu-ga: Convert invocation documentation to rST (2019-09-13 16:05:01 +0100)

----------------------------------------------------------------
target-arm queue:
* aspeed: add a GPIO controller to the SoC
* aspeed: Various refactorings
* aspeed: Improve DMA controller modelling
* atomic_template: fix indentation in GEN_ATOMIC_HELPER
* qemu-ga: Convert invocation documentation to rST

----------------------------------------------------------------
Christian Svensson (1):
aspeed/smc: Calculate checksum on normal DMA

Cédric Le Goater (7):
aspeed: Remove unused SoC definitions
aspeed: Use consistent typenames
aspeed/smc: Add support for DMAs
aspeed/smc: Add DMA calibration settings aspeed/smc: Inject errors in DMA checksum aspeed/scu: Introduce per-SoC SCU types aspeed/scu: Introduce a aspeed_scu_get_apb_freq() routine

Emilio G. Cota (1):
atomic_template: fix indentation in GEN_ATOMIC_HELPER

Peter Maydell (1):
qemu-ga: Convert invocation documentation to rST

Rashmica Gupta (2):
hw/gpio: Add basic Aspeed GPIO model for AST2400 and AST2500
aspeed: add a GPIO controller to the SoC

 Makefile                      |  24 +-
 hw/gpio/Makefile.objs         |   1 +
 accel/tcg/atomic_template.h   |   2 +-
 include/hw/arm/aspeed_soc.h   |   4 +-
 include/hw/gpio/aspeed_gpio.h | 100 +++++
 include/hw/misc/aspeed_scu.h  |  21 +-
 include/hw/ssi/aspeed_smc.h   |   7 +
 hw/arm/aspeed.c               |   2 +
 hw/arm/aspeed_soc.c           |  63 ++-
 hw/gpio/aspeed_gpio.c         | 884 ++++++++++++++++++++++++++++++++++++++++++
 hw/misc/aspeed_scu.c          | 102 ++---
 hw/ssi/aspeed_smc.c           | 335 +++++++++++++++-
 hw/timer/aspeed_timer.c       |   3 +-
 MAINTAINERS                   |   2 +-
 docs/conf.py                  |  18 +-
 docs/interop/conf.py          |   7 +
 docs/interop/index.rst        |   1 +
 docs/interop/qemu-ga.rst      | 133 +++++++
 qemu-doc.texi                 |   5 -
 qemu-ga.texi                  | 137 -------
 20 files changed, 1585 insertions(+), 266 deletions(-)
 create mode 100644 include/hw/gpio/aspeed_gpio.h
 create mode 100644 hw/gpio/aspeed_gpio.c
 create mode 100644 docs/interop/qemu-ga.rst
 delete mode 100644 qemu-ga.texi
#1 lore raw

[Qemu-devel] [PULL 03/12] aspeed: Remove unused SoC definitions

From: Cédric Le Goater <[email protected]>

There are no QEMU Aspeed machines using the SoCs "ast2400-a0" or "ast2400".

Message-id: [email protected]

---
 hw/arm/aspeed_soc.c | 26 --------------------------
 1 file changed, 26 deletions(-)
hw/arm/aspeed_soc.c +0 -26
index 04480875d0d..3aa73d2438e 100644
@@ -118,19 +118,6 @@ static const char *aspeed_soc_ast2500_typenames[] = {
 
 static const AspeedSoCInfo aspeed_socs[] = {
     {
-        .name         = "ast2400-a0",
-        .cpu_type     = ARM_CPU_TYPE_NAME("arm926"),
-        .silicon_rev  = AST2400_A0_SILICON_REV,
-        .sram_size    = 0x8000,
-        .spis_num     = 1,
-        .fmc_typename = "aspeed.smc.fmc",
-        .spi_typename = aspeed_soc_ast2400_typenames,
-        .gpio_typename = "aspeed.gpio-ast2400",
-        .wdts_num     = 2,
-        .irqmap       = aspeed_soc_ast2400_irqmap,
-        .memmap       = aspeed_soc_ast2400_memmap,
-        .num_cpus     = 1,
-    }, {
         .name         = "ast2400-a1",
         .cpu_type     = ARM_CPU_TYPE_NAME("arm926"),
         .silicon_rev  = AST2400_A1_SILICON_REV,
@@ -143,19 +130,6 @@ static const AspeedSoCInfo aspeed_socs[] = {
         .irqmap       = aspeed_soc_ast2400_irqmap,
         .memmap       = aspeed_soc_ast2400_memmap,
         .num_cpus     = 1,
-    }, {
-        .name         = "ast2400",
-        .cpu_type     = ARM_CPU_TYPE_NAME("arm926"),
-        .silicon_rev  = AST2400_A0_SILICON_REV,
-        .sram_size    = 0x8000,
-        .spis_num     = 1,
-        .fmc_typename = "aspeed.smc.fmc",
-        .spi_typename = aspeed_soc_ast2400_typenames,
-        .gpio_typename = "aspeed.gpio-ast2400",
-        .wdts_num     = 2,
-        .irqmap       = aspeed_soc_ast2400_irqmap,
-        .memmap       = aspeed_soc_ast2400_memmap,
-        .num_cpus     = 1,
     }, {
         .name         = "ast2500-a1",
         .cpu_type     = ARM_CPU_TYPE_NAME("arm1176"),
Signature · 1 line
2.20.1
#2 lore raw

[Qemu-devel] [PULL 04/12] aspeed: Use consistent typenames

In reply to Peter Maydell

From: Cédric Le Goater <[email protected]>

Improve the naming of the different controller models to ease their generation when initializing the SoC. The rename of the SMC types is breaking migration compatibility.

Message-id: [email protected]

---
 include/hw/arm/aspeed_soc.h |  3 ---
 hw/arm/aspeed_soc.c         | 25 ++++++++++++-------------
 hw/ssi/aspeed_smc.c         | 12 ++++++------
 3 files changed, 18 insertions(+), 22 deletions(-)
include/hw/arm/aspeed_soc.h +0 -3
index a56effebc16..ab5052b12cb 100644
@@ -61,9 +61,6 @@ typedef struct AspeedSoCInfo {
     uint32_t silicon_rev;
     uint64_t sram_size;
     int spis_num;
-    const char *fmc_typename;
-    const char **spi_typename;
-    const char *gpio_typename;
     int wdts_num;
     const int *irqmap;
     const hwaddr *memmap;
hw/arm/aspeed_soc.c +12 -13
index 3aa73d2438e..25dbc409d35 100644
@@ -112,10 +112,6 @@ static const int aspeed_soc_ast2400_irqmap[] = {
 
 #define aspeed_soc_ast2500_irqmap aspeed_soc_ast2400_irqmap
 
-static const char *aspeed_soc_ast2400_typenames[] = { "aspeed.smc.spi" };
-static const char *aspeed_soc_ast2500_typenames[] = {
-    "aspeed.smc.ast2500-spi1", "aspeed.smc.ast2500-spi2" };
-
 static const AspeedSoCInfo aspeed_socs[] = {
     {
         .name         = "ast2400-a1",
@@ -123,9 +119,6 @@ static const AspeedSoCInfo aspeed_socs[] = {
         .silicon_rev  = AST2400_A1_SILICON_REV,
         .sram_size    = 0x8000,
         .spis_num     = 1,
-        .fmc_typename = "aspeed.smc.fmc",
-        .spi_typename = aspeed_soc_ast2400_typenames,
-        .gpio_typename = "aspeed.gpio-ast2400",
         .wdts_num     = 2,
         .irqmap       = aspeed_soc_ast2400_irqmap,
         .memmap       = aspeed_soc_ast2400_memmap,
@@ -136,9 +129,6 @@ static const AspeedSoCInfo aspeed_socs[] = {
         .silicon_rev  = AST2500_A1_SILICON_REV,
         .sram_size    = 0x9000,
         .spis_num     = 2,
-        .fmc_typename = "aspeed.smc.ast2500-fmc",
-        .spi_typename = aspeed_soc_ast2500_typenames,
-        .gpio_typename = "aspeed.gpio-ast2500",
         .wdts_num     = 3,
         .irqmap       = aspeed_soc_ast2500_irqmap,
         .memmap       = aspeed_soc_ast2500_memmap,
@@ -158,6 +148,12 @@ static void aspeed_soc_init(Object *obj)
     AspeedSoCState *s = ASPEED_SOC(obj);
     AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
     int i;
+    char socname[8];
+    char typename[64];
+
+    if (sscanf(sc->info->name, "%7s", socname) != 1) {
+        g_assert_not_reached();
+    }
 
     for (i = 0; i < sc->info->num_cpus; i++) {
         object_initialize_child(obj, "cpu[*]", OBJECT(&s->cpu[i]),
@@ -190,14 +186,16 @@ static void aspeed_soc_init(Object *obj)
     sysbus_init_child_obj(obj, "i2c", OBJECT(&s->i2c), sizeof(s->i2c),
                           TYPE_ASPEED_I2C);
 
+    snprintf(typename, sizeof(typename), "aspeed.fmc-%s", socname);
     sysbus_init_child_obj(obj, "fmc", OBJECT(&s->fmc), sizeof(s->fmc),
-                          sc->info->fmc_typename);
+                          typename);
     object_property_add_alias(obj, "num-cs", OBJECT(&s->fmc), "num-cs",
                               &error_abort);
 
     for (i = 0; i < sc->info->spis_num; i++) {
+        snprintf(typename, sizeof(typename), "aspeed.spi%d-%s", i + 1, socname);
         sysbus_init_child_obj(obj, "spi[*]", OBJECT(&s->spi[i]),
-                              sizeof(s->spi[i]), sc->info->spi_typename[i]);
+                              sizeof(s->spi[i]), typename);
     }
 
     sysbus_init_child_obj(obj, "sdmc", OBJECT(&s->sdmc), sizeof(s->sdmc),
@@ -226,8 +224,9 @@ static void aspeed_soc_init(Object *obj)
     sysbus_init_child_obj(obj, "xdma", OBJECT(&s->xdma), sizeof(s->xdma),
                           TYPE_ASPEED_XDMA);
 
+    snprintf(typename, sizeof(typename), "aspeed.gpio-%s", socname);
     sysbus_init_child_obj(obj, "gpio", OBJECT(&s->gpio), sizeof(s->gpio),
-                          sc->info->gpio_typename);
+                          typename);
 }
 
 static void aspeed_soc_realize(DeviceState *dev, Error **errp)
hw/ssi/aspeed_smc.c +6 -6
index 9f3cff5fb6f..f4f7c181830 100644
@@ -190,7 +190,7 @@ static const AspeedSegments aspeed_segments_ast2500_spi2[] = {
 
 static const AspeedSMCController controllers[] = {
     {
-        .name              = "aspeed.smc.smc",
+        .name              = "aspeed.smc-ast2400",
         .r_conf            = R_CONF,
         .r_ce_ctrl         = R_CE_CTRL,
         .r_ctrl0           = R_CTRL0,
@@ -203,7 +203,7 @@ static const AspeedSMCController controllers[] = {
         .has_dma           = false,
         .nregs             = ASPEED_SMC_R_SMC_MAX,
     }, {
-        .name              = "aspeed.smc.fmc",
+        .name              = "aspeed.fmc-ast2400",
         .r_conf            = R_CONF,
         .r_ce_ctrl         = R_CE_CTRL,
         .r_ctrl0           = R_CTRL0,
@@ -216,7 +216,7 @@ static const AspeedSMCController controllers[] = {
         .has_dma           = true,
         .nregs             = ASPEED_SMC_R_MAX,
     }, {
-        .name              = "aspeed.smc.spi",
+        .name              = "aspeed.spi1-ast2400",
         .r_conf            = R_SPI_CONF,
         .r_ce_ctrl         = 0xff,
         .r_ctrl0           = R_SPI_CTRL0,
@@ -229,7 +229,7 @@ static const AspeedSMCController controllers[] = {
         .has_dma           = false,
         .nregs             = ASPEED_SMC_R_SPI_MAX,
     }, {
-        .name              = "aspeed.smc.ast2500-fmc",
+        .name              = "aspeed.fmc-ast2500",
         .r_conf            = R_CONF,
         .r_ce_ctrl         = R_CE_CTRL,
         .r_ctrl0           = R_CTRL0,
@@ -242,7 +242,7 @@ static const AspeedSMCController controllers[] = {
         .has_dma           = true,
         .nregs             = ASPEED_SMC_R_MAX,
     }, {
-        .name              = "aspeed.smc.ast2500-spi1",
+        .name              = "aspeed.spi1-ast2500",
         .r_conf            = R_CONF,
         .r_ce_ctrl         = R_CE_CTRL,
         .r_ctrl0           = R_CTRL0,
@@ -255,7 +255,7 @@ static const AspeedSMCController controllers[] = {
         .has_dma           = false,
         .nregs             = ASPEED_SMC_R_MAX,
     }, {
-        .name              = "aspeed.smc.ast2500-spi2",
+        .name              = "aspeed.spi2-ast2500",
         .r_conf            = R_CONF,
         .r_ce_ctrl         = R_CE_CTRL,
         .r_ctrl0           = R_CTRL0,
Signature · 1 line
2.20.1
#3 lore raw

[Qemu-devel] [PULL 08/12] aspeed/smc: Calculate checksum on normal DMA

In reply to Peter Maydell

From: Christian Svensson <[email protected]>

This patch adds the missing checksum calculation on normal DMA transfer. According to the datasheet this is how the SMC should behave.

Verified on AST1250 that the hardware matches the behaviour.

Message-id: [email protected]

---
 hw/ssi/aspeed_smc.c | 1 +
 1 file changed, 1 insertion(+)
hw/ssi/aspeed_smc.c +1 -0
index 5c3436db5e8..9ffc7e01179 100644
@@ -989,6 +989,7 @@ static void aspeed_smc_dma_rw(AspeedSMCState *s)
         s->regs[R_DMA_FLASH_ADDR] += 4;
         s->regs[R_DMA_DRAM_ADDR] += 4;
         s->regs[R_DMA_LEN] -= 4;
+        s->regs[R_DMA_CHECKSUM] += data;
     }
 }
 
Signature · 1 line
2.20.1
#4 lore raw

[Qemu-devel] [PULL 09/12] aspeed/scu: Introduce per-SoC SCU types

In reply to Peter Maydell

From: Cédric Le Goater <[email protected]>

and use a class AspeedSCUClass to define each SoC characteristics.

Message-id: [email protected]

---
 include/hw/misc/aspeed_scu.h | 15 +++++++
 hw/arm/aspeed_soc.c          |  3 +-
 hw/misc/aspeed_scu.c         | 83 ++++++++++++++++++++----------------
 3 files changed, 64 insertions(+), 37 deletions(-)
include/hw/misc/aspeed_scu.h +15 -0
index 38996adc59f..90dd4dadede 100644
@@ -15,6 +15,8 @@
 
 #define TYPE_ASPEED_SCU "aspeed.scu"
 #define ASPEED_SCU(obj) OBJECT_CHECK(AspeedSCUState, (obj), TYPE_ASPEED_SCU)
+#define TYPE_ASPEED_2400_SCU TYPE_ASPEED_SCU "-ast2400"
+#define TYPE_ASPEED_2500_SCU TYPE_ASPEED_SCU "-ast2500"
 
 #define ASPEED_SCU_NR_REGS (0x1A8 >> 2)
 
@@ -45,6 +47,19 @@ typedef struct AspeedSCUState {
 
 extern bool is_supported_silicon_rev(uint32_t silicon_rev);
 
+#define ASPEED_SCU_CLASS(klass) \
+     OBJECT_CLASS_CHECK(AspeedSCUClass, (klass), TYPE_ASPEED_SCU)
+#define ASPEED_SCU_GET_CLASS(obj) \
+     OBJECT_GET_CLASS(AspeedSCUClass, (obj), TYPE_ASPEED_SCU)
+
+typedef struct  AspeedSCUClass {
+    SysBusDeviceClass parent_class;
+
+    const uint32_t *resets;
+    uint32_t (*calc_hpll)(AspeedSCUState *s);
+    uint32_t apb_divider;
+}  AspeedSCUClass;
+
 #define ASPEED_SCU_PROT_KEY      0x1688A8A8
 
 /*
hw/arm/aspeed_soc.c +2 -1
index da508c99c33..cf1d0cf921b 100644
@@ -161,8 +161,9 @@ static void aspeed_soc_init(Object *obj)
                                 &error_abort, NULL);
     }
 
+    snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname);
     sysbus_init_child_obj(obj, "scu", OBJECT(&s->scu), sizeof(s->scu),
-                          TYPE_ASPEED_SCU);
+                          typename);
     qdev_prop_set_uint32(DEVICE(&s->scu), "silicon-rev",
                          sc->info->silicon_rev);
     object_property_add_alias(obj, "hw-strap1", OBJECT(&s->scu),
hw/misc/aspeed_scu.c +47 -36

127 lines not on this page · raw message

Signature · 1 line
2.20.1
#5 lore raw

[Qemu-devel] [PULL 01/12] hw/gpio: Add basic Aspeed GPIO model for AST2400 and AST2500

In reply to Peter Maydell

From: Rashmica Gupta <[email protected]>

GPIO pins are arranged in groups of 8 pins labeled A,B,..,Y,Z,AA,AB,AC. (Note that the ast2400 controller only goes up to group AB). A set has four groups (except set AC which only has one) and is referred to by the groups it is composed of (eg ABCD,EFGH,...,YZAAAB). Each set is accessed and controlled by a bank of 14 registers.

These registers operate on a per pin level where each bit in the register corresponds to a pin, except for the command source registers. The command source registers operate on a per group level where bits 24, 16, 8 and 0 correspond to each group in the set.

eg. registers for set ABCD:

 |D7...D0|C7...C0|B7...B0|A7...A0| <- GPIOs
 |31...24|23...16|15....8|7.....0| <- bit position

Note that there are a couple of groups that only have 4 pins.

There are two ways that this model deviates from the behaviour of the actual controller:
(1) The only control source driving the GPIO pins in the model is the ARM model (as there currently aren't models for the LPC or Coprocessor).

(2) None of the registers in the model are reset tolerant (needs integration with the watchdog).

Message-id: [email protected] [clg: fixed missing header files
made use of HWADDR_PRIx to fix compilation on windows ]

---
 hw/gpio/Makefile.objs         |   1 +
 include/hw/gpio/aspeed_gpio.h | 100 ++++
 hw/gpio/aspeed_gpio.c         | 884 ++++++++++++++++++++++++++++++++++
 3 files changed, 985 insertions(+)
 create mode 100644 include/hw/gpio/aspeed_gpio.h
 create mode 100644 hw/gpio/aspeed_gpio.c
hw/gpio/Makefile.objs +1 -0
index e5da0cb54fe..d305b3b24b1 100644
@@ -9,3 +9,4 @@ obj-$(CONFIG_OMAP) += omap_gpio.o
 obj-$(CONFIG_IMX) += imx_gpio.o
 obj-$(CONFIG_RASPI) += bcm2835_gpio.o
 obj-$(CONFIG_NRF51_SOC) += nrf51_gpio.o
+obj-$(CONFIG_ASPEED_SOC) += aspeed_gpio.o
include/hw/gpio/aspeed_gpio.h new file +100 -0

100 lines not on this page · raw message

hw/gpio/aspeed_gpio.c new file +884 -0

884 lines not on this page · raw message

Signature · 1 line
2.20.1
#6 lore raw

[Qemu-devel] [PULL 02/12] aspeed: add a GPIO controller to the SoC

In reply to Peter Maydell

From: Rashmica Gupta <[email protected]>

Message-id: [email protected]

---
 include/hw/arm/aspeed_soc.h |  3 +++
 hw/arm/aspeed_soc.c         | 17 +++++++++++++++++
 2 files changed, 20 insertions(+)
include/hw/arm/aspeed_soc.h +3 -0
index 976fd6be93f..a56effebc16 100644
@@ -23,6 +23,7 @@
 #include "hw/watchdog/wdt_aspeed.h"
 #include "hw/net/ftgmac100.h"
 #include "target/arm/cpu.h"
+#include "hw/gpio/aspeed_gpio.h"
 
 #define ASPEED_SPIS_NUM  2
 #define ASPEED_WDTS_NUM  3
@@ -48,6 +49,7 @@ typedef struct AspeedSoCState {
     AspeedSDMCState sdmc;
     AspeedWDTState wdt[ASPEED_WDTS_NUM];
     FTGMAC100State ftgmac100[ASPEED_MACS_NUM];
+    AspeedGPIOState gpio;
 } AspeedSoCState;
 
 #define TYPE_ASPEED_SOC "aspeed-soc"
@@ -61,6 +63,7 @@ typedef struct AspeedSoCInfo {
     int spis_num;
     const char *fmc_typename;
     const char **spi_typename;
+    const char *gpio_typename;
     int wdts_num;
     const int *irqmap;
     const hwaddr *memmap;
hw/arm/aspeed_soc.c +17 -0
index 9ee81048326..04480875d0d 100644
@@ -125,6 +125,7 @@ static const AspeedSoCInfo aspeed_socs[] = {
         .spis_num     = 1,
         .fmc_typename = "aspeed.smc.fmc",
         .spi_typename = aspeed_soc_ast2400_typenames,
+        .gpio_typename = "aspeed.gpio-ast2400",
         .wdts_num     = 2,
         .irqmap       = aspeed_soc_ast2400_irqmap,
         .memmap       = aspeed_soc_ast2400_memmap,
@@ -137,6 +138,7 @@ static const AspeedSoCInfo aspeed_socs[] = {
         .spis_num     = 1,
         .fmc_typename = "aspeed.smc.fmc",
         .spi_typename = aspeed_soc_ast2400_typenames,
+        .gpio_typename = "aspeed.gpio-ast2400",
         .wdts_num     = 2,
         .irqmap       = aspeed_soc_ast2400_irqmap,
         .memmap       = aspeed_soc_ast2400_memmap,
@@ -149,6 +151,7 @@ static const AspeedSoCInfo aspeed_socs[] = {
         .spis_num     = 1,
         .fmc_typename = "aspeed.smc.fmc",
         .spi_typename = aspeed_soc_ast2400_typenames,
+        .gpio_typename = "aspeed.gpio-ast2400",
         .wdts_num     = 2,
         .irqmap       = aspeed_soc_ast2400_irqmap,
         .memmap       = aspeed_soc_ast2400_memmap,
@@ -161,6 +164,7 @@ static const AspeedSoCInfo aspeed_socs[] = {
         .spis_num     = 2,
         .fmc_typename = "aspeed.smc.ast2500-fmc",
         .spi_typename = aspeed_soc_ast2500_typenames,
+        .gpio_typename = "aspeed.gpio-ast2500",
         .wdts_num     = 3,
         .irqmap       = aspeed_soc_ast2500_irqmap,
         .memmap       = aspeed_soc_ast2500_memmap,
@@ -247,6 +251,9 @@ static void aspeed_soc_init(Object *obj)
 
     sysbus_init_child_obj(obj, "xdma", OBJECT(&s->xdma), sizeof(s->xdma),
                           TYPE_ASPEED_XDMA);
+
+    sysbus_init_child_obj(obj, "gpio", OBJECT(&s->gpio), sizeof(s->gpio),
+                          sc->info->gpio_typename);
 }
 
 static void aspeed_soc_realize(DeviceState *dev, Error **errp)
@@ -426,6 +433,16 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
                     sc->info->memmap[ASPEED_XDMA]);
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->xdma), 0,
                        aspeed_soc_get_irq(s, ASPEED_XDMA));
+
+    /* GPIO */
+    object_property_set_bool(OBJECT(&s->gpio), true, "realized", &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
+    }
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, sc->info->memmap[ASPEED_GPIO]);
+    sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio), 0,
+                       aspeed_soc_get_irq(s, ASPEED_GPIO));
 }
 static Property aspeed_soc_properties[] = {
     DEFINE_PROP_UINT32("num-cpus", AspeedSoCState, num_cpus, 0),
Signature · 1 line
2.20.1
#7 lore raw

[Qemu-devel] [PULL 11/12] atomic_template: fix indentation in GEN_ATOMIC_HELPER

In reply to Peter Maydell

From: "Emilio G. Cota" <[email protected]>

---
 accel/tcg/atomic_template.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
accel/tcg/atomic_template.h +1 -1
index df9c8388178..287433d809b 100644
@@ -149,7 +149,7 @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr,
 
 #define GEN_ATOMIC_HELPER(X)                                        \
 ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr,       \
-                 ABI_TYPE val EXTRA_ARGS)                           \
+                        ABI_TYPE val EXTRA_ARGS)                    \
 {                                                                   \
     ATOMIC_MMU_DECLS;                                               \
     DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP;                           \
Signature · 1 line
2.20.1
#8 lore raw

[Qemu-devel] [PULL 06/12] aspeed/smc: Add DMA calibration settings

In reply to Peter Maydell

From: Cédric Le Goater <[email protected]>

When doing calibration, the SPI clock rate in the CE0 Control Register and the read delay cycles in the Read Timing Compensation Register are set using bit[11:4] of the DMA Control Register.

Message-id: [email protected]

---
 hw/ssi/aspeed_smc.c | 64 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 63 insertions(+), 1 deletion(-)
hw/ssi/aspeed_smc.c +63 -1
index c1a45c10dc1..7a0cd7607fd 100644
@@ -77,6 +77,10 @@
 #define   CTRL_CMD_MASK            0xff
 #define   CTRL_DUMMY_HIGH_SHIFT    14
 #define   CTRL_AST2400_SPI_4BYTE   (1 << 13)
+#define CE_CTRL_CLOCK_FREQ_SHIFT   8
+#define CE_CTRL_CLOCK_FREQ_MASK    0xf
+#define CE_CTRL_CLOCK_FREQ(div)                                         \
+    (((div) & CE_CTRL_CLOCK_FREQ_MASK) << CE_CTRL_CLOCK_FREQ_SHIFT)
 #define   CTRL_DUMMY_LOW_SHIFT     6 /* 2 bits [7:6] */
 #define   CTRL_CE_STOP_ACTIVE      (1 << 2)
 #define   CTRL_CMD_MODE_MASK       0x3
@@ -112,7 +116,7 @@
 #define   DMA_CTRL_DELAY_SHIFT  8
 #define   DMA_CTRL_FREQ_MASK    0xf
 #define   DMA_CTRL_FREQ_SHIFT   4
-#define   DMA_CTRL_MODE         (1 << 3)
+#define   DMA_CTRL_CALIB        (1 << 3)
 #define   DMA_CTRL_CKSUM        (1 << 2)
 #define   DMA_CTRL_WRITE        (1 << 1)
 #define   DMA_CTRL_ENABLE       (1 << 0)
@@ -811,6 +815,60 @@ static uint64_t aspeed_smc_read(void *opaque, hwaddr addr, unsigned int size)
     }
 }
 
+static uint8_t aspeed_smc_hclk_divisor(uint8_t hclk_mask)
+{
+    /* HCLK/1 .. HCLK/16 */
+    const uint8_t hclk_divisors[] = {
+        15, 7, 14, 6, 13, 5, 12, 4, 11, 3, 10, 2, 9, 1, 8, 0
+    };
+    int i;
+
+    for (i = 0; i < ARRAY_SIZE(hclk_divisors); i++) {
+        if (hclk_mask == hclk_divisors[i]) {
+            return i + 1;
+        }
+    }
+
+    qemu_log_mask(LOG_GUEST_ERROR, "invalid HCLK mask %x", hclk_mask);
+    return 0;
+}
+
+/*
+ * When doing calibration, the SPI clock rate in the CE0 Control
+ * Register and the read delay cycles in the Read Timing Compensation
+ * Register are set using bit[11:4] of the DMA Control Register.
+ */
+static void aspeed_smc_dma_calibration(AspeedSMCState *s)
+{
+    uint8_t delay =
+        (s->regs[R_DMA_CTRL] >> DMA_CTRL_DELAY_SHIFT) & DMA_CTRL_DELAY_MASK;
+    uint8_t hclk_mask =
+        (s->regs[R_DMA_CTRL] >> DMA_CTRL_FREQ_SHIFT) & DMA_CTRL_FREQ_MASK;
+    uint8_t hclk_div = aspeed_smc_hclk_divisor(hclk_mask);
+    uint32_t hclk_shift = (hclk_div - 1) << 2;
+    uint8_t cs;
+
+    /*
+     * The Read Timing Compensation Register values apply to all CS on
+     * the SPI bus and only HCLK/1 - HCLK/5 can have tunable delays
+     */
+    if (hclk_div && hclk_div < 6) {
+        s->regs[s->r_timings] &= ~(0xf << hclk_shift);
+        s->regs[s->r_timings] |= delay << hclk_shift;
+    }
+
+    /*
+     * TODO: compute the CS from the DMA address and the segment
+     * registers. This is not really a problem for now because the
+     * Timing Register values apply to all CS and software uses CS0 to
+     * do calibration.
+     */
+    cs = 0;
+    s->regs[s->r_ctrl0 + cs] &=
+        ~(CE_CTRL_CLOCK_FREQ_MASK << CE_CTRL_CLOCK_FREQ_SHIFT);
+    s->regs[s->r_ctrl0 + cs] |= CE_CTRL_CLOCK_FREQ(hclk_div);
+}
+
 /*
  * Accumulate the result of the reads to provide a checksum that will
  * be used to validate the read timing settings.
@@ -826,6 +884,10 @@ static void aspeed_smc_dma_checksum(AspeedSMCState *s)
         return;
     }
 
+    if (s->regs[R_DMA_CTRL] & DMA_CTRL_CALIB) {
+        aspeed_smc_dma_calibration(s);
+    }
+
     while (s->regs[R_DMA_LEN]) {
         data = address_space_ldl_le(&s->flash_as, s->regs[R_DMA_FLASH_ADDR],
                                     MEMTXATTRS_UNSPECIFIED, &result);
Signature · 1 line
2.20.1
#9 lore raw

Re: [PULL 06/12] aspeed/smc: Add DMA calibration settings

Quoted 7 lines · Peter Maydell

From: Cédric Le Goater <[email protected]>

When doing calibration, the SPI clock rate in the CE0 Control Register and the read delay cycles in the Read Timing Compensation Register are set using bit[11:4] of the DMA Control Register.

Quoted 5 lines

Message-id: [email protected]

Hi; this is an old patch, but Coverity has suddenly decided it doesn't like it (CID 1547822):

Quoted 21 lines
hw/ssi/aspeed_smc.c +21 -0
+static uint8_t aspeed_smc_hclk_divisor(uint8_t hclk_mask)
+{
+    /* HCLK/1 .. HCLK/16 */
+    const uint8_t hclk_divisors[] = {
+        15, 7, 14, 6, 13, 5, 12, 4, 11, 3, 10, 2, 9, 1, 8, 0
+    };
+    int i;
+
+    for (i = 0; i < ARRAY_SIZE(hclk_divisors); i++) {
+        if (hclk_mask == hclk_divisors[i]) {
+            return i + 1;
+        }
+    }
+
+    qemu_log_mask(LOG_GUEST_ERROR, "invalid HCLK mask %x", hclk_mask);
+    return 0;
+}
+
+/*
+ * When doing calibration, the SPI clock rate in the CE0 Control
+ * Register and the read delay cycles in the Read Timing Compensation

hw/ssi/aspeed_smc.c static uint64_t aspeed_smc_read(void *opaque, hwaddr addr, unsigned int size) · line 848

Quoted 10 lines
hw/ssi/aspeed_smc.c +10 -0
+ * Register are set using bit[11:4] of the DMA Control Register.
+ */
+static void aspeed_smc_dma_calibration(AspeedSMCState *s)
+{
+    uint8_t delay =
+        (s->regs[R_DMA_CTRL] >> DMA_CTRL_DELAY_SHIFT) & DMA_CTRL_DELAY_MASK;
+    uint8_t hclk_mask =
+        (s->regs[R_DMA_CTRL] >> DMA_CTRL_FREQ_SHIFT) & DMA_CTRL_FREQ_MASK;
+    uint8_t hclk_div = aspeed_smc_hclk_divisor(hclk_mask);
+    uint32_t hclk_shift = (hclk_div - 1) << 2;

The code of aspeeed_smc_hclk_divisor() has a codepath where it can return 0, and this callsite doesn't check for 0, and so Coverity thinks that we might end up shifting -1 by 2 to get the hclk_shift here, which means we overflow the value, which it thinks is probably not what we meant to do.

In fact this can't happen, because we always pass aspeed_smc_hclk_divisor() a value between 0 and 15, and if we do that then we always get back a value between 1 and 16. So I think the right fix would be
to change the qemu_log_mask()/return 0 to be g_assert_not_reached().

thanks
-- PMM

#10 lore raw

Re: [PULL 06/12] aspeed/smc: Add DMA calibration settings

Quoted 55 lines · Peter Maydell
Quoted 7 lines · Peter Maydell

From: Cédric Le Goater <[email protected]>

When doing calibration, the SPI clock rate in the CE0 Control Register and the read delay cycles in the Read Timing Compensation Register are set using bit[11:4] of the DMA Control Register.

Quoted 5 lines

Message-id: [email protected]

Hi; this is an old patch, but Coverity has suddenly decided it doesn't like it (CID 1547822):

Quoted 21 lines
hw/ssi/aspeed_smc.c +21 -0
+static uint8_t aspeed_smc_hclk_divisor(uint8_t hclk_mask)
+{
+    /* HCLK/1 .. HCLK/16 */
+    const uint8_t hclk_divisors[] = {
+        15, 7, 14, 6, 13, 5, 12, 4, 11, 3, 10, 2, 9, 1, 8, 0
+    };
+    int i;
+
+    for (i = 0; i < ARRAY_SIZE(hclk_divisors); i++) {
+        if (hclk_mask == hclk_divisors[i]) {
+            return i + 1;
+        }
+    }
+
+    qemu_log_mask(LOG_GUEST_ERROR, "invalid HCLK mask %x", hclk_mask);
+    return 0;
+}
+
+/*
+ * When doing calibration, the SPI clock rate in the CE0 Control
+ * Register and the read delay cycles in the Read Timing Compensation

hw/ssi/aspeed_smc.c static uint64_t aspeed_smc_read(void *opaque, hwaddr addr, unsigned int size) · line 848

Quoted 10 lines
hw/ssi/aspeed_smc.c +10 -0
+ * Register are set using bit[11:4] of the DMA Control Register.
+ */
+static void aspeed_smc_dma_calibration(AspeedSMCState *s)
+{
+    uint8_t delay =
+        (s->regs[R_DMA_CTRL] >> DMA_CTRL_DELAY_SHIFT) & DMA_CTRL_DELAY_MASK;
+    uint8_t hclk_mask =
+        (s->regs[R_DMA_CTRL] >> DMA_CTRL_FREQ_SHIFT) & DMA_CTRL_FREQ_MASK;
+    uint8_t hclk_div = aspeed_smc_hclk_divisor(hclk_mask);
+    uint32_t hclk_shift = (hclk_div - 1) << 2;

The code of aspeeed_smc_hclk_divisor() has a codepath where it can return 0, and this callsite doesn't check for 0, and so Coverity thinks that we might end up shifting -1 by 2 to get the hclk_shift here, which means we overflow the value, which it thinks is probably not what we meant to do.

Quoted 4 lines

In fact this can't happen, because we always pass aspeed_smc_hclk_divisor() a value between 0 and 15, and if we do that then we always get back a value between 1 and 16. So I think the right fix would be
to change the qemu_log_mask()/return 0 to be g_assert_not_reached().

I was wondering how to fix it. Thanks for the suggestion. Will do in the 9.1 cycle.

C.

Quoted 3 lines

thanks
-- PMM

#11 lore raw

[Qemu-devel] [PULL 05/12] aspeed/smc: Add support for DMAs

In reply to Peter Maydell

From: Cédric Le Goater <[email protected]>

The FMC controller on the Aspeed SoCs support DMA to access the flash modules. It can operate in a normal mode, to copy to or from the flash module mapping window, or in a checksum calculation mode, to evaluate the best clock settings for reads.

The model introduces two custom address spaces for DMAs: one for the AHB window of the FMC flash devices and one for the DRAM. The latter is populated using a "dram" link set from the machine with the RAM container region.

Message-id: [email protected]

---
 include/hw/ssi/aspeed_smc.h |   6 +
 hw/arm/aspeed.c             |   2 +
 hw/arm/aspeed_soc.c         |   2 +
 hw/ssi/aspeed_smc.c         | 222 +++++++++++++++++++++++++++++++++++-
 4 files changed, 226 insertions(+), 6 deletions(-)
include/hw/ssi/aspeed_smc.h +6 -0
index aa07dac4fe3..32ce6916f6c 100644
@@ -46,6 +46,8 @@ typedef struct AspeedSMCController {
     hwaddr flash_window_base;
     uint32_t flash_window_size;
     bool has_dma;
+    hwaddr dma_flash_mask;
+    hwaddr dma_dram_mask;
     uint32_t nregs;
 } AspeedSMCController;
 
@@ -101,6 +103,10 @@ typedef struct AspeedSMCState {
     /* for DMA support */
     uint64_t sdram_base;
 
+    AddressSpace flash_as;
+    MemoryRegion *dram_mr;
+    AddressSpace dram_as;
+
     AspeedSMCFlash *flashes;
 
     uint8_t snoop_index;
hw/arm/aspeed.c +2 -0
index 13e208c78cc..aa72be309da 100644
@@ -190,6 +190,8 @@ static void aspeed_board_init(MachineState *machine,
                             &error_abort);
     object_property_set_int(OBJECT(&bmc->soc), machine->smp.cpus, "num-cpus",
                             &error_abort);
+    object_property_set_link(OBJECT(&bmc->soc), OBJECT(&bmc->ram_container),
+                             "dram", &error_abort);
     if (machine->kernel_filename) {
         /*
          * When booting with a -kernel command line there is no u-boot
hw/arm/aspeed_soc.c +2 -0
index 25dbc409d35..da508c99c33 100644
@@ -191,6 +191,8 @@ static void aspeed_soc_init(Object *obj)
                           typename);
     object_property_add_alias(obj, "num-cs", OBJECT(&s->fmc), "num-cs",
                               &error_abort);
+    object_property_add_alias(obj, "dram", OBJECT(&s->fmc), "dram",
+                              &error_abort);
 
     for (i = 0; i < sc->info->spis_num; i++) {
         snprintf(typename, sizeof(typename), "aspeed.spi%d-%s", i + 1, socname);
hw/ssi/aspeed_smc.c +216 -6

303 lines not on this page · raw message

Signature · 1 line
2.20.1
#12 lore raw

[Qemu-devel] [PULL 07/12] aspeed/smc: Inject errors in DMA checksum

In reply to Peter Maydell

From: Cédric Le Goater <[email protected]>

Emulate read errors in the DMA Checksum Register for high frequencies and optimistic settings of the Read Timing Compensation Register. This will help in tuning the SPI timing calibration algorithm. Errors are only injected when the property "inject_failure" is set to true as suggested by Philippe.

The values below are those to expect from the first flash device of the FMC controller of a palmetto-bmc machine.

Message-id: [email protected]

---
 include/hw/ssi/aspeed_smc.h |  1 +
 hw/ssi/aspeed_smc.c         | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
include/hw/ssi/aspeed_smc.h +1 -0
index 32ce6916f6c..5176ff6bf95 100644
@@ -88,6 +88,7 @@ typedef struct AspeedSMCState {
 
     uint32_t num_cs;
     qemu_irq *cs_lines;
+    bool inject_failure;
 
     SSIBus *spi;
 
hw/ssi/aspeed_smc.c +36 -0
index 7a0cd7607fd..5c3436db5e8 100644
@@ -869,6 +869,36 @@ static void aspeed_smc_dma_calibration(AspeedSMCState *s)
     s->regs[s->r_ctrl0 + cs] |= CE_CTRL_CLOCK_FREQ(hclk_div);
 }
 
+/*
+ * Emulate read errors in the DMA Checksum Register for high
+ * frequencies and optimistic settings of the Read Timing Compensation
+ * Register. This will help in tuning the SPI timing calibration
+ * algorithm.
+ */
+static bool aspeed_smc_inject_read_failure(AspeedSMCState *s)
+{
+    uint8_t delay =
+        (s->regs[R_DMA_CTRL] >> DMA_CTRL_DELAY_SHIFT) & DMA_CTRL_DELAY_MASK;
+    uint8_t hclk_mask =
+        (s->regs[R_DMA_CTRL] >> DMA_CTRL_FREQ_SHIFT) & DMA_CTRL_FREQ_MASK;
+
+    /*
+     * Typical values of a palmetto-bmc machine.
+     */
+    switch (aspeed_smc_hclk_divisor(hclk_mask)) {
+    case 4 ... 16:
+        return false;
+    case 3: /* at least one HCLK cycle delay */
+        return (delay & 0x7) < 1;
+    case 2: /* at least two HCLK cycle delay */
+        return (delay & 0x7) < 2;
+    case 1: /* (> 100MHz) is above the max freq of the controller */
+        return true;
+    default:
+        g_assert_not_reached();
+    }
+}
+
 /*
  * Accumulate the result of the reads to provide a checksum that will
  * be used to validate the read timing settings.
@@ -905,6 +935,11 @@ static void aspeed_smc_dma_checksum(AspeedSMCState *s)
         s->regs[R_DMA_FLASH_ADDR] += 4;
         s->regs[R_DMA_LEN] -= 4;
     }
+
+    if (s->inject_failure && aspeed_smc_inject_read_failure(s)) {
+        s->regs[R_DMA_CHECKSUM] = 0xbadc0de;
+    }
+
 }
 
 static void aspeed_smc_dma_rw(AspeedSMCState *s)
@@ -1185,6 +1220,7 @@ static const VMStateDescription vmstate_aspeed_smc = {
 
 static Property aspeed_smc_properties[] = {
     DEFINE_PROP_UINT32("num-cs", AspeedSMCState, num_cs, 1),
+    DEFINE_PROP_BOOL("inject-failure", AspeedSMCState, inject_failure, false),
     DEFINE_PROP_UINT64("sdram-base", AspeedSMCState, sdram_base, 0),
     DEFINE_PROP_LINK("dram", AspeedSMCState, dram_mr,
                      TYPE_MEMORY_REGION, MemoryRegion *),
Signature · 1 line
2.20.1
#13 lore raw

[Qemu-devel] [PULL 12/12] qemu-ga: Convert invocation documentation to rST

In reply to Peter Maydell

The qemu-ga documentation is currently in qemu-ga.texi in Texinfo format, which we present to the user as:
* a qemu-ga manpage
* a section of the main qemu-doc HTML documentation

Convert the documentation to rST format, and present it to the user as:
* a qemu-ga manpage
* part of the interop/ Sphinx manual

Message-id: [email protected]

---
 Makefile                 |  24 ++++---
 MAINTAINERS              |   2 +-
 docs/conf.py             |  18 ++---
 docs/interop/conf.py     |   7 ++
 docs/interop/index.rst   |   1 +
 docs/interop/qemu-ga.rst | 133 +++++++++++++++++++++++++++++++++++++
 qemu-doc.texi            |   5 --
 qemu-ga.texi             | 137 ---------------------------------------
 8 files changed, 166 insertions(+), 161 deletions(-)
 create mode 100644 docs/interop/qemu-ga.rst
 delete mode 100644 qemu-ga.texi
Makefile +14 -10
index b3528617e48..111082ce545 100644
@@ -325,7 +325,7 @@ endif
 endif
 
 ifdef BUILD_DOCS
-DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 qemu-ga.8
+DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 docs/interop/qemu-ga.8
 DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
 DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
 DOCS+=docs/qemu-block-drivers.7
@@ -783,10 +783,11 @@ DESCS=
 endif
 
 # Note that we manually filter-out the non-Sphinx documentation which
-# is currently built into the docs/interop directory in the build tree.
+# is currently built into the docs/interop directory in the build tree,
+# and also any sphinx-built manpages.
 define install-manual =
 for d in $$(cd $(MANUAL_BUILDDIR) && find $1 -type d); do $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)/$$d"; done
-for f in $$(cd $(MANUAL_BUILDDIR) && find $1 -type f -a '!' '(' -name 'qemu-*-qapi.*' -o -name 'qemu-*-ref.*' ')' ); do $(INSTALL_DATA) "$(MANUAL_BUILDDIR)/$$f" "$(DESTDIR)$(qemu_docdir)/$$f"; done
+for f in $$(cd $(MANUAL_BUILDDIR) && find $1 -type f -a '!' '(' -name '*.[0-9]' -o -name 'qemu-*-qapi.*' -o -name 'qemu-*-ref.*' ')' ); do $(INSTALL_DATA) "$(MANUAL_BUILDDIR)/$$f" "$(DESTDIR)$(qemu_docdir)/$$f"; done
 endef
 
 # Note that we deliberately do not install the "devel" manual: it is
@@ -818,7 +819,7 @@ ifdef CONFIG_TRACE_SYSTEMTAP
 	$(INSTALL_DATA) scripts/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1"
 endif
 ifneq (,$(findstring qemu-ga,$(TOOLS)))
-	$(INSTALL_DATA) qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
+	$(INSTALL_DATA) docs/interop/qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
 	$(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)"
 	$(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)"
 	$(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7"
@@ -977,18 +978,22 @@ docs/version.texi: $(SRC_PATH)/VERSION config-host.mak
 sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html $(MANUAL_BUILDDIR)/interop/index.html $(MANUAL_BUILDDIR)/specs/index.html
 
 # Canned command to build a single manual
-build-manual = $(call quiet-command,sphinx-build $(if $(V),,-q) -W -n -b html -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1")
+# Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
+build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" sphinx-build $(if $(V),,-q) -W -n -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1")
 # We assume all RST files in the manual's directory are used in it
 manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst) $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py
 
 $(MANUAL_BUILDDIR)/devel/index.html: $(call manual-deps,devel)
-	$(call build-manual,devel)
+	$(call build-manual,devel,html)
 
 $(MANUAL_BUILDDIR)/interop/index.html: $(call manual-deps,interop)
-	$(call build-manual,interop)
+	$(call build-manual,interop,html)
 
 $(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs)
-	$(call build-manual,specs)
+	$(call build-manual,specs,html)
+
+$(MANUAL_BUILDDIR)/interop/qemu-ga.8: $(call manual-deps,interop)
+	$(call build-manual,interop,man)
 
 qemu-options.texi: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
@@ -1013,7 +1018,6 @@ qemu.1: qemu-option-trace.texi
 qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
 fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
 qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
-qemu-ga.8: qemu-ga.texi
 docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi
 docs/qemu-cpu-models.7: docs/qemu-cpu-models.texi
 scripts/qemu-trace-stap.1: scripts/qemu-trace-stap.texi
@@ -1026,7 +1030,7 @@ txt: qemu-doc.txt docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
 qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \
 	qemu-img.texi qemu-nbd.texi qemu-options.texi \
 	qemu-tech.texi qemu-option-trace.texi \
-	qemu-deprecated.texi qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \
+	qemu-deprecated.texi qemu-monitor.texi qemu-img-cmds.texi \
 	qemu-monitor-info.texi docs/qemu-block-drivers.texi \
 	docs/qemu-cpu-models.texi docs/security.texi
 
MAINTAINERS +1 -1
index 50eaf005f40..f0e30b5248c 100644
@@ -2040,7 +2040,7 @@ QEMU Guest Agent
 M: Michael Roth <[email protected]>
 S: Maintained
 F: qga/
-F: qemu-ga.texi
+F: docs/interop/qemu-ga.rst
 F: scripts/qemu-guest-agent/
 F: tests/test-qga.c
 F: docs/interop/qemu-ga-ref.texi
docs/conf.py +10 -8
index e46b299b71f..b7edb0666b5 100644
@@ -115,6 +115,14 @@ todo_include_todos = False
 # with "option::" in the document being processed. Turn that off.
 suppress_warnings = ["ref.option"]
 
+# The rst_epilog fragment is effectively included in every rST file.
+# We use it to define substitutions based on build config that
+# can then be used in the documentation. The fallback if the
+# environment variable is not set is for the benefit of readthedocs
+# style document building; our Makefile always sets the variable.
+confdir = os.getenv('CONFDIR', "/etc/qemu")
+rst_epilog = ".. |CONFDIR| replace:: ``" + confdir + "``\n"
+
 # -- Options for HTML output ----------------------------------------------
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
@@ -192,14 +200,8 @@ latex_documents = [
 
 
 # -- Options for manual page output ---------------------------------------
-
-# One entry per manual page. List of tuples
-# (source start file, name, description, authors, manual section).
-man_pages = [
-    (master_doc, 'qemu', u'QEMU Documentation',
-     [author], 1)
-]
-
+# Individual manual/conf.py can override this to create man pages
+man_pages = []
 
 # -- Options for Texinfo output -------------------------------------------
 
docs/interop/conf.py +7 -0
index cf3c69d4a7e..e87b8c22bec 100644
@@ -13,3 +13,10 @@ exec(compile(open(parent_config, "rb").read(), parent_config, 'exec'))
 # This slightly misuses the 'description', but is the best way to get
 # the manual title to appear in the sidebar.
 html_theme_options['description'] = u'System Emulation Management and Interoperability Guide'
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('qemu-ga', 'qemu-ga', u'QEMU Guest Agent',
+     ['Michael Roth <[email protected]>'], 8)
+]
docs/interop/index.rst +1 -0
index b4bfcab4171..3e33fb59332 100644
@@ -15,5 +15,6 @@ Contents:
    bitmaps
    live-block-operations
    pr-helper
+   qemu-ga
    vhost-user
    vhost-user-gpu
docs/interop/qemu-ga.rst new file +133 -0

133 lines not on this page · raw message

qemu-doc.texi +0 -5
index b47e89cfca6..2ba6c90c083 100644
@@ -2535,11 +2535,6 @@ so should only be used with trusted guest OS.
 
 @c man end
 
-@node QEMU Guest Agent
-@chapter QEMU Guest Agent invocation
-
-@include qemu-ga.texi
-
 @node QEMU User space emulator
 @chapter QEMU User space emulator
 
qemu-ga.texi deleted +0 -137

137 lines not on this page · raw message

Signature · 1 line
2.20.1
#14 lore raw

Re: [Qemu-devel] [PULL 12/12] qemu-ga: Convert invocation documentation to rST

Quoted 10 lines · Peter Maydell

The qemu-ga documentation is currently in qemu-ga.texi in Texinfo format, which we present to the user as:
* a qemu-ga manpage
* a section of the main qemu-doc HTML documentation

Convert the documentation to rST format, and present it to the user as:
* a qemu-ga manpage
* part of the interop/ Sphinx manual

Quoted 5 lines

Message-id: [email protected]
---

In an incremental build on Fedora 30, I'm now seeing:

CHK version_gen.h
GEN docs/interop/qemu-ga.8
No filename or title
make: *** [/home/eblake/qemu/rules.mak:394: docs/interop/qemu-ga.8] Error 255

and suspect this patch introduced it. It may be that I just need to nuke intermediate artifacts rather than an actual problem with the patch, but I'd welcome help in identifying the problem.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#15 lore raw

Re: [Qemu-devel] [PULL 12/12] qemu-ga: Convert invocation documentation to rST

Quoted 25 lines · Eric Blake
Quoted 10 lines · Peter Maydell

The qemu-ga documentation is currently in qemu-ga.texi in Texinfo format, which we present to the user as:
* a qemu-ga manpage
* a section of the main qemu-doc HTML documentation

Convert the documentation to rST format, and present it to the user as:
* a qemu-ga manpage
* part of the interop/ Sphinx manual

Quoted 5 lines

Message-id: [email protected]
---

In an incremental build on Fedora 30, I'm now seeing:

CHK version_gen.h
GEN docs/interop/qemu-ga.8
No filename or title
make: *** [/home/eblake/qemu/rules.mak:394: docs/interop/qemu-ga.8] Error 255

Quoted 3 lines

and suspect this patch introduced it. It may be that I just need to nuke intermediate artifacts rather than an actual problem with the patch, but I'd welcome help in identifying the problem.

It did - it's also the commit that has broken shippable builds. Once I reverted they started working again. However I'm finding it hard to trigger in the same containers on my setup so I'm confused as to how it breaks.

--
Alex Bennée

#16 lore raw

Re: [Qemu-devel] [PULL 12/12] qemu-ga: Convert invocation documentation to rST

In reply to Eric Blake
Quoted 26 lines · Eric Blake
Quoted 10 lines · Peter Maydell

The qemu-ga documentation is currently in qemu-ga.texi in Texinfo format, which we present to the user as:
* a qemu-ga manpage
* a section of the main qemu-doc HTML documentation

Convert the documentation to rST format, and present it to the user as:
* a qemu-ga manpage
* part of the interop/ Sphinx manual

Quoted 5 lines

Message-id: [email protected]
---

In an incremental build on Fedora 30, I'm now seeing:

CHK version_gen.h
GEN docs/interop/qemu-ga.8
No filename or title
make: *** [/home/eblake/qemu/rules.mak:394: docs/interop/qemu-ga.8] Error 255

Quoted 3 lines

and suspect this patch introduced it. It may be that I just need to nuke intermediate artifacts rather than an actual problem with the patch, but I'd welcome help in identifying the problem.

If you build with V=1 what does it say it's doing?

thanks
-- PMM

#17 lore raw

Re: [Qemu-devel] [PULL 12/12] qemu-ga: Convert invocation documentation to rST

Quoted 8 lines · Peter Maydell
Quoted 8 lines

In an incremental build on Fedora 30, I'm now seeing:

CHK version_gen.h
GEN docs/interop/qemu-ga.8
No filename or title
make: *** [/home/eblake/qemu/rules.mak:394: docs/interop/qemu-ga.8] Error 255

Quoted 5 lines
Quoted 3 lines

and suspect this patch introduced it. It may be that I just need to nuke intermediate artifacts rather than an actual problem with the patch, but I'd welcome help in identifying the problem.

If you build with V=1 what does it say it's doing?

make[1]: Leaving directory '/home/eblake/qemu/dtc'
perl -Ww -- /home/eblake/qemu/scripts/texi2pod.pl -I docs -I scripts -I docs/interop -DVERSION="4.1.50" -DCONFDIR="/usr/local/etc/qemu" scripts/texi2pod.pl docs/interop/qemu-ga.8.pod && pod2man --utf8 --section=8 --center=" " --release=" " docs/interop/qemu-ga.8.pod > docs/interop/qemu-ga.8
No filename or title
make: *** [/home/eblake/qemu/rules.mak:394: docs/interop/qemu-ga.8] Error 255

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#18 lore raw

Re: [Qemu-devel] [PULL 12/12] qemu-ga: Convert invocation documentation to rST

Quoted 17 lines · Eric Blake
Quoted 8 lines · Peter Maydell
Quoted 8 lines

In an incremental build on Fedora 30, I'm now seeing:

CHK version_gen.h
GEN docs/interop/qemu-ga.8
No filename or title
make: *** [/home/eblake/qemu/rules.mak:394: docs/interop/qemu-ga.8] Error 255

Quoted 5 lines
Quoted 3 lines

and suspect this patch introduced it. It may be that I just need to nuke intermediate artifacts rather than an actual problem with the patch, but I'd welcome help in identifying the problem.

If you build with V=1 what does it say it's doing?

Quoted 9 lines

make[1]: Leaving directory '/home/eblake/qemu/dtc'
perl -Ww -- /home/eblake/qemu/scripts/texi2pod.pl -I docs -I scripts -I docs/interop -DVERSION="4.1.50" -DCONFDIR="/usr/local/etc/qemu" scripts/texi2pod.pl docs/interop/qemu-ga.8.pod && pod2man --utf8 --section=8 --center=" " --release=" " docs/interop/qemu-ga.8.pod > docs/interop/qemu-ga.8
No filename or title
make: *** [/home/eblake/qemu/rules.mak:394: docs/interop/qemu-ga.8] Error 255

Do you have sphinx installed on this machine? I'm wondering if the problem here is that we have disabled the sphinx build runes but are then falling back to the "try to make any %.8 via the TEXI2MAN rule in rules.mak" [*]. On the other hand docs/interop/qemu-ga.8 is only put into DOCS if BUILD_DOCS is set, which should only happen if sphinx is available.

[*] these rules are a bit bogus, because I think they will apply even if there's no other rule saying 'foo.8 depends on something.texi', and then as you can see in your command line we end up running texi2pod with an empty "$<" rather than passing it a texi file.

thanks
-- PMM

#19 lore raw

Re: [Qemu-devel] [PULL 12/12] qemu-ga: Convert invocation documentation to rST

Quoted 28 lines · Peter Maydell
Quoted 17 lines · Eric Blake
Quoted 8 lines · Peter Maydell
Quoted 8 lines

In an incremental build on Fedora 30, I'm now seeing:

CHK version_gen.h
GEN docs/interop/qemu-ga.8
No filename or title
make: *** [/home/eblake/qemu/rules.mak:394: docs/interop/qemu-ga.8] Error 255

Quoted 5 lines
Quoted 3 lines

and suspect this patch introduced it. It may be that I just need to nuke intermediate artifacts rather than an actual problem with the patch, but I'd welcome help in identifying the problem.

If you build with V=1 what does it say it's doing?

Quoted 9 lines

make[1]: Leaving directory '/home/eblake/qemu/dtc'
perl -Ww -- /home/eblake/qemu/scripts/texi2pod.pl -I docs -I scripts -I docs/interop -DVERSION="4.1.50" -DCONFDIR="/usr/local/etc/qemu" scripts/texi2pod.pl docs/interop/qemu-ga.8.pod && pod2man --utf8 --section=8 --center=" " --release=" " docs/interop/qemu-ga.8.pod > docs/interop/qemu-ga.8
No filename or title
make: *** [/home/eblake/qemu/rules.mak:394: docs/interop/qemu-ga.8] Error 255

Quoted 1 line

Do you have sphinx installed on this machine?

Not yet.

/me goes and installs sphinx-2.2.11-12.fc30.x86_64

Nope, problem is still happening even after rerunning ./configure

Quoted 11 lines

I'm wondering
if the problem here is that we have disabled the sphinx build runes but are then falling back to the "try to make any %.8 via the TEXI2MAN rule in rules.mak" [*]. On the other hand docs/interop/qemu-ga.8 is only put into DOCS if BUILD_DOCS is set, which should only happen if sphinx is available.

[*] these rules are a bit bogus, because I think they will apply even if there's no other rule saying 'foo.8 depends on something.texi', and then as you can see in your command line we end up running texi2pod with an empty "$<" rather than passing it a texi file.

Okay, that's something to play with.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#20 lore raw

Re: [Qemu-devel] [PULL 12/12] qemu-ga: Convert invocation documentation to rST

Quoted 30 lines · Eric Blake
Quoted 28 lines · Peter Maydell
Quoted 26 lines · Eric Blake
Quoted 8 lines · Peter Maydell
Quoted 8 lines

In an incremental build on Fedora 30, I'm now seeing:

CHK version_gen.h
GEN docs/interop/qemu-ga.8
No filename or title
make: *** [/home/eblake/qemu/rules.mak:394: docs/interop/qemu-ga.8] Error 255

Quoted 5 lines
Quoted 3 lines

and suspect this patch introduced it. It may be that I just need to nuke intermediate artifacts rather than an actual problem with the patch, but I'd welcome help in identifying the problem.

If you build with V=1 what does it say it's doing?

make[1]: Leaving directory '/home/eblake/qemu/dtc'
perl -Ww -- /home/eblake/qemu/scripts/texi2pod.pl -I docs -I scripts -I docs/interop -DVERSION="4.1.50" -DCONFDIR="/usr/local/etc/qemu" scripts/texi2pod.pl docs/interop/qemu-ga.8.pod && pod2man --utf8 --section=8 --center=" " --release=" " docs/interop/qemu-ga.8.pod > docs/interop/qemu-ga.8
No filename or title
make: *** [/home/eblake/qemu/rules.mak:394: docs/interop/qemu-ga.8] Error 255

Quoted 7 lines
Quoted 1 line

Do you have sphinx installed on this machine?

Not yet.

/me goes and installs sphinx-2.2.11-12.fc30.x86_64

Nope, problem is still happening even after rerunning ./configure

Alex looked at this and suggests the problem is probably because you're doing an in-tree build. Sphinx insists that it can't build output files into the source tree, so we have a thing where we set MANUAL_BUILDDIR to docs/built if we're doing an in-tree build. But the filename we add to DOCS is just "docs/interop/qemu-ga.8" so for an in-tree build the sphinx rule won't match it, and the install rune won't find it either.

If that's the cause I think this untested fix should help:

Makefile +0 -1
index 111082ce545..8d9dcb3aa4a 100644
@@ -325,7 +325,7 @@ endif
 endif
 
 ifdef BUILD_DOCS
-DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8

docs/interop/qemu-ga.8
+DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 $(MANUAL_BUILDDIR)/interop/qemu-ga.8
DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt
docs/interop/qemu-qmp-ref.7
DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt
docs/interop/qemu-ga-ref.7
DOCS+=docs/qemu-block-drivers.7
@@ -819,7 +819,7 @@ ifdef CONFIG_TRACE_SYSTEMTAP

        $(INSTALL_DATA) scripts/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1"

endif
ifneq (,$(findstring qemu-ga,$(TOOLS)))
- $(INSTALL_DATA) docs/interop/qemu-ga.8 "$(DESTDIR)$(mandir)/man8"
+ $(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/qemu-ga.8
"$(DESTDIR)$(mandir)/man8"

        $(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)"
        $(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)"
        $(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7"

thanks
-- PMM

#21 lore raw

Re: [Qemu-devel] [PULL 12/12] qemu-ga: Convert invocation documentation to rST

Quoted 2 lines · Peter Maydell

Alex looked at this and suggests the problem is probably because you're doing an in-tree build.

Bingo. I thought we wanted to get rid of that, though. What's the status on forcing out-of-tree builds? (I'll adapt, but only once patches are in that force me to).

Quoted 14 lines

Sphinx insists that it can't build
output files into the source tree, so we have a thing where we set MANUAL_BUILDDIR to docs/built if we're doing an in-tree build. But the filename we add to DOCS is just "docs/interop/qemu-ga.8" so for an in-tree build the sphinx rule won't match it, and the install rune won't find it either.

If that's the cause I think this untested fix should help:

Makefile +0 -0
index 111082ce545..8d9dcb3aa4a 100644

Makefile endif · line 326

Quoted 2 lines
Makefile +0 -0
@@ -325,7 +325,7 @@ endif
 endif
 

[1]

Quoted 5 lines
Makefile +0 -1
 ifdef BUILD_DOCS
-DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8

docs/interop/qemu-ga.8
+DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 $(MANUAL_BUILDDIR)/interop/qemu-ga.8

Not quite. This occurs prior to the line defining MANUAL_BUILDDIR, resulting in:

GEN /interop/qemu-ga.8
opening "/interop": No such file or directory

But hoisting the following text up to point [1] makes the build complete with sphinx installed. Progress!

Quoted 10 lines

# Sphinx does not allow building manuals into the same directory as

# the source files, so if we're doing an in-tree QEMU build we must
# build the manuals into a subdirectory (and then install them from
# there for 'make install'). For an out-of-tree build we can just
# use the docs/ subdirectory in the build tree as normal.
ifeq ($(realpath $(SRC_PATH)),$(realpath .))
MANUAL_BUILDDIR := docs/built
else
MANUAL_BUILDDIR := docs
endif
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#22 lore raw

Re: [Qemu-devel] [PULL 12/12] qemu-ga: Convert invocation documentation to rST

Quoted 9 lines · Eric Blake
Quoted 2 lines · Peter Maydell

Alex looked at this and suggests the problem is probably because you're doing an in-tree build.

Bingo. I thought we wanted to get rid of that, though. What's the status on forcing out-of-tree builds? (I'll adapt, but only once patches are in that force me to).

I think the general consensus was that it would probably be a good idea, but nobody's actually written any code :-) (Among other things, various bits of CI infra, probably the tests/vm code, etc, need updating to not try to do an in-tree build.)

thanks
-- PMM

#23 lore raw

Re: [Qemu-devel] [PULL 12/12] qemu-ga: Convert invocation documentation to rST

Quoted 11 lines · Peter Maydell
Quoted 9 lines · Eric Blake
Quoted 2 lines · Peter Maydell

Alex looked at this and suggests the problem is probably because you're doing an in-tree build.

Bingo. I thought we wanted to get rid of that, though. What's the status on forcing out-of-tree builds? (I'll adapt, but only once patches are in that force me to).

Quoted 5 lines

I think the general consensus was that it would probably be a good idea, but nobody's actually written any code :-) (Among other things, various bits of CI infra, probably the tests/vm code, etc, need updating to not try to do an in-tree build.)

We have another issue introduced by this patch and not fixed yet, caused by this sphinx-build bug:
https://github.com/sphinx-doc/sphinx/issues/2946

We're triggering that bug because the interop/index.html and interop/qemu-ga.8 rules are using the same doctree cache directory.

Signature · 1 line
Eduardo
#24 lore raw

Re: [Qemu-devel] [PULL 12/12] qemu-ga: Convert invocation documentation to rST

In reply to Peter Maydell
Quoted 27 lines · Peter Maydell
Quoted 26 lines · Eric Blake
Quoted 10 lines · Peter Maydell

The qemu-ga documentation is currently in qemu-ga.texi in Texinfo format, which we present to the user as:
* a qemu-ga manpage
* a section of the main qemu-doc HTML documentation

Convert the documentation to rST format, and present it to the user as:
* a qemu-ga manpage
* part of the interop/ Sphinx manual

Quoted 5 lines

Message-id: [email protected]
---

In an incremental build on Fedora 30, I'm now seeing:

CHK version_gen.h
GEN docs/interop/qemu-ga.8
No filename or title
make: *** [/home/eblake/qemu/rules.mak:394: docs/interop/qemu-ga.8] Error 255

Quoted 5 lines
Quoted 3 lines

and suspect this patch introduced it. It may be that I just need to nuke intermediate artifacts rather than an actual problem with the patch, but I'd welcome help in identifying the problem.

If you build with V=1 what does it say it's doing?

This is what shippable shows:

make -I/root/src/github.com/stsquad/qemu/dtc VPATH=/root/src/github.com/stsquad/qemu/dtc -C dtc V="1" LIBFDT_srcdir=/root/src/github.com/stsquad/qemu/dtc/libfdt CPPFLAGS="-I/root/src/github.com/stsquad/qemu/dtc -I/root/src/github.com/stsquad/qemu/dtc -I/root/src/github.com/stsquad/qemu/dtc/libfdt" CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g -I/usr/include/pixman-1 -I/root/src/github.com/stsquad/qemu/dtc/libfdt -Werror -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1 -I/usr/include/libpng16 -I/usr/include/spice-server -I/usr/include/spice-1 -I/root/src/github.com/stsquad/qemu/capstone/include -I/root/src/github.com/stsquad/qemu/tests" LDFLAGS="-Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g " ARFLAGS="rv" CC="cc" AR="ar" LD="ld" BUILD_DIR=/root/src/github.com/stsquad/qemu libfdt/libfdt.a
if ! cmp -s qemu-version.h qemu-version.h.tmp; then mv qemu-version.h.tmp qemu-version.h; else rm qemu-version.h.tmp; fi
make[1]: Entering directory '/root/src/github.com/stsquad/qemu/dtc'
make[1]: Entering directory '/root/src/github.com/stsquad/qemu/slirp'
make -C /root/src/github.com/stsquad/qemu/capstone CAPSTONE_SHARED=no BUILDDIR="/root/src/github.com/stsquad/qemu/capstone" CC="cc" AR="ar" LD="ld" RANLIB="ranlib" CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g -I/usr/include/pixman-1 -I/root/src/github.com/stsquad/qemu/dtc/libfdt -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -fstack-protector-strong -I/usr/include/p11-kit-1 -I/usr/include/libpng16 -I/usr/include/spice-server -I/usr/include/spice-1 -I/root/src/github.com/stsquad/qemu/capstone/include -I/root/src/github.com/stsquad/qemu/tests -DCAPSTONE_USE_SYS_DYN_MEM -DCAPSTONE_HAS_ARM -DCAPSTONE_HAS_ARM64 -DCAPSTONE_HAS_POWERPC -DCAPSTONE_HAS_X86" BUILD_DIR=/root/src/github.com/stsquad/qemu /root/src/github.com/stsquad/qemu/capstone/libcapstone.a make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/root/src/github.com/stsquad/qemu/slirp'
make[1]: Entering directory '/root/src/github.com/stsquad/qemu/capstone'
set -e; echo ' CHK version_gen.h'; mkdir -p ./; (echo "#define DTC_VERSION \"DTC 1.4.7\""; ) < Makefile > version_gen.h.tmp; if [ -r version_gen.h ] && cmp -s version_gen.h version_gen.h.tmp; then rm -f version_gen.h.tmp; else echo ' UPD version_gen.h'; mv -f version_gen.h.tmp version_gen.h; fi;
CHK version_gen.h
make[1]: '/root/src/github.com/stsquad/qemu/capstone/libcapstone.a' is up to date.
make[1]: Leaving directory '/root/src/github.com/stsquad/qemu/capstone'
make[1]: 'libfdt/libfdt.a' is up to date.
make[1]: Leaving directory '/root/src/github.com/stsquad/qemu/dtc'
cc -iquote /root/src/github.com/stsquad/qemu/tests/qemu-iotests -iquote tests/qemu-iotests -iquote /root/src/github.com/stsquad/qemu/tcg -iquote /root/src/github.com/stsquad/qemu/tcg/i386 -I/root/src/github.com/stsquad/qemu/linux-headers -I/root/src/github.com/stsquad/qemu/linux-headers -iquote . -iquote /root/src/github.com/stsquad/qemu -iquote /root/src/github.com/stsquad/qemu/accel/tcg -iquote /root/src/github.com/stsquad/qemu/include -I/usr/include/pixman-1 -I/root/src/github.com/stsquad/qemu/dtc/libfdt -Werror -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1 -I/usr/include/libpng16 -I/usr/include/spice-server -I/usr/include/spice-1 -I/root/src/github.com/stsquad/qemu/capstone/include -I/root/src/github.com/stsquad/qemu/tests -MMD -MP -MT tests/qemu-iotests/socket_scm_helper.o -MF tests/qemu-iotests/socket_scm_helper.d -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g -c -o tests/qemu-iotests/socket_scm_helper.o tests/qemu-iotests/socket_scm_helper.c
( echo "@set VERSION 4.1.50" && echo "@set CONFDIR /usr/local/etc/qemu" )> docs/version.texi
sh /root/src/github.com/stsquad/qemu/scripts/hxtool -t < /root/src/github.com/stsquad/qemu/qemu-options.hx > qemu-options.texi
sh /root/src/github.com/stsquad/qemu/scripts/hxtool -t < /root/src/github.com/stsquad/qemu/hmp-commands.hx > qemu-monitor.texi
sh /root/src/github.com/stsquad/qemu/scripts/hxtool -t < /root/src/github.com/stsquad/qemu/qemu-img-cmds.hx > qemu-img-cmds.texi
sh /root/src/github.com/stsquad/qemu/scripts/hxtool -t < /root/src/github.com/stsquad/qemu/hmp-commands-info.hx > qemu-monitor-info.texi
perl -Ww -- /root/src/github.com/stsquad/qemu/scripts/texi2pod.pl -I docs -I . -I . -DVERSION="4.1.50" -DCONFDIR="/usr/local/etc/qemu" qemu-img.texi qemu-img.1.pod && pod2man --utf8 --section=1 --center=" " --release=" " qemu-img.1.pod > qemu-img.1
perl -Ww -- /root/src/github.com/stsquad/qemu/scripts/texi2pod.pl -I docs -I . -I . -DVERSION="4.1.50" -DCONFDIR="/usr/local/etc/qemu" qemu-nbd.texi qemu-nbd.8.pod && pod2man --utf8 --section=8 --center=" " --release=" " qemu-nbd.8.pod > qemu-nbd.8
perl -Ww -- /root/src/github.com/stsquad/qemu/scripts/texi2pod.pl -I docs -I scripts -I docs/interop -DVERSION="4.1.50" -DCONFDIR="/usr/local/etc/qemu" scripts/texi2pod.pl docs/interop/qemu-ga.8.pod && pod2man --utf8 --section=8 --center=" " --release=" " docs/interop/qemu-ga.8.pod > docs/interop/qemu-ga.8
python3 -B /root/src/github.com/stsquad/qemu/scripts/qapi-gen.py -o qga/qapi-generated -p "qga-" /root/src/github.com/stsquad/qemu/qga/qapi-schema.json
No filename or title
/root/src/github.com/stsquad/qemu/rules.mak:394: recipe for target 'docs/interop/qemu-ga.8' failed
make: *** [docs/interop/qemu-ga.8] Error 255
make: *** Waiting for unfinished jobs....

--
Alex Bennée

#25 lore raw

[Qemu-devel] [PULL 10/12] aspeed/scu: Introduce a aspeed_scu_get_apb_freq() routine

In reply to Peter Maydell

From: Cédric Le Goater <[email protected]>

The APB frequency can be calculated directly when needed from the HPLL_PARAM and CLK_SEL register values. This removes useless state in the model.

Message-id: [email protected]

---
 include/hw/misc/aspeed_scu.h |  8 +++-----
 hw/misc/aspeed_scu.c         | 25 +++++++++----------------
 hw/timer/aspeed_timer.c      |  3 ++-
 3 files changed, 14 insertions(+), 22 deletions(-)
include/hw/misc/aspeed_scu.h +3 -5
index 90dd4dadede..239e94fe2c4 100644
@@ -32,10 +32,6 @@ typedef struct AspeedSCUState {
     uint32_t hw_strap1;
     uint32_t hw_strap2;
     uint32_t hw_prot_key;
-
-    uint32_t clkin;
-    uint32_t hpll;
-    uint32_t apb_freq;
 } AspeedSCUState;
 
 #define AST2400_A0_SILICON_REV   0x02000303U
@@ -56,12 +52,14 @@ typedef struct  AspeedSCUClass {
     SysBusDeviceClass parent_class;
 
     const uint32_t *resets;
-    uint32_t (*calc_hpll)(AspeedSCUState *s);
+    uint32_t (*calc_hpll)(AspeedSCUState *s, uint32_t hpll_reg);
     uint32_t apb_divider;
 }  AspeedSCUClass;
 
 #define ASPEED_SCU_PROT_KEY      0x1688A8A8
 
+uint32_t aspeed_scu_get_apb_freq(AspeedSCUState *s);
+
 /*
  * Extracted from Aspeed SDK v00.03.21. Fixes and extra definitions
  * were added.
hw/misc/aspeed_scu.c +9 -16
index d284458b9b3..620b25c2047 100644
@@ -164,11 +164,12 @@ static uint32_t aspeed_scu_get_random(void)
     return num;
 }
 
-static void aspeed_scu_set_apb_freq(AspeedSCUState *s)
+uint32_t aspeed_scu_get_apb_freq(AspeedSCUState *s)
 {
     AspeedSCUClass *asc = ASPEED_SCU_GET_CLASS(s);
+    uint32_t hpll = asc->calc_hpll(s, s->regs[HPLL_PARAM]);
 
-    s->apb_freq = s->hpll / (SCU_CLK_GET_PCLK_DIV(s->regs[CLK_SEL]) + 1)
+    return hpll / (SCU_CLK_GET_PCLK_DIV(s->regs[CLK_SEL]) + 1)
         / asc->apb_divider;
 }
 
@@ -228,7 +229,6 @@ static void aspeed_scu_write(void *opaque, hwaddr offset, uint64_t data,
         return;
     case CLK_SEL:
         s->regs[reg] = data;
-        aspeed_scu_set_apb_freq(s);
         break;
     case HW_STRAP1:
         if (ASPEED_IS_AST2500(s->regs[SILICON_REV])) {
@@ -290,11 +290,11 @@ static const uint32_t hpll_ast2400_freqs[][4] = {
     { 400, 375, 350, 425 }, /* 25MHz */
 };
 
-static uint32_t aspeed_2400_scu_calc_hpll(AspeedSCUState *s)
+static uint32_t aspeed_2400_scu_calc_hpll(AspeedSCUState *s, uint32_t hpll_reg)
 {
-    uint32_t hpll_reg = s->regs[HPLL_PARAM];
     uint8_t freq_select;
     bool clk_25m_in;
+    uint32_t clkin = aspeed_scu_get_clkin(s);
 
     if (hpll_reg & SCU_AST2400_H_PLL_OFF) {
         return 0;
@@ -311,7 +311,7 @@ static uint32_t aspeed_2400_scu_calc_hpll(AspeedSCUState *s)
             multiplier = (2 - od) * ((n + 2) / (d + 1));
         }
 
-        return s->clkin * multiplier;
+        return clkin * multiplier;
     }
 
     /* HW strapping */
@@ -321,10 +321,10 @@ static uint32_t aspeed_2400_scu_calc_hpll(AspeedSCUState *s)
     return hpll_ast2400_freqs[clk_25m_in][freq_select] * 1000000;
 }
 
-static uint32_t aspeed_2500_scu_calc_hpll(AspeedSCUState *s)
+static uint32_t aspeed_2500_scu_calc_hpll(AspeedSCUState *s, uint32_t hpll_reg)
 {
-    uint32_t hpll_reg   = s->regs[HPLL_PARAM];
     uint32_t multiplier = 1;
+    uint32_t clkin = aspeed_scu_get_clkin(s);
 
     if (hpll_reg & SCU_H_PLL_OFF) {
         return 0;
@@ -338,7 +338,7 @@ static uint32_t aspeed_2500_scu_calc_hpll(AspeedSCUState *s)
         multiplier = ((m + 1) / (n + 1)) / (p + 1);
     }
 
-    return s->clkin * multiplier;
+    return clkin * multiplier;
 }
 
 static void aspeed_scu_reset(DeviceState *dev)
@@ -351,13 +351,6 @@ static void aspeed_scu_reset(DeviceState *dev)
     s->regs[HW_STRAP1] = s->hw_strap1;
     s->regs[HW_STRAP2] = s->hw_strap2;
     s->regs[PROT_KEY] = s->hw_prot_key;
-
-    /*
-     * All registers are set. Now compute the frequencies of the main clocks
-     */
-    s->clkin = aspeed_scu_get_clkin(s);
-    s->hpll = asc->calc_hpll(s);
-    aspeed_scu_set_apb_freq(s);
 }
 
 static uint32_t aspeed_silicon_revs[] = {
hw/timer/aspeed_timer.c +2 -1
index 59c2bbeee60..2bda826882d 100644
@@ -93,7 +93,8 @@ static inline uint32_t calculate_rate(struct AspeedTimer *t)
 {
     AspeedTimerCtrlState *s = timer_to_ctrl(t);
 
-    return timer_external_clock(t) ? TIMER_CLOCK_EXT_HZ : s->scu->apb_freq;
+    return timer_external_clock(t) ? TIMER_CLOCK_EXT_HZ :
+        aspeed_scu_get_apb_freq(s->scu);
 }
 
 static inline uint32_t calculate_ticks(struct AspeedTimer *t, uint64_t now_ns)
Signature · 1 line
2.20.1
author Applied
#26 lore raw
In reply to Peter Maydell
Quoted 26 lines · Peter Maydell

target-arm queue: mostly aspeed changes from Cédric.

thanks
-- PMM

The following changes since commit 85182c96de61f0b600bbe834d5a23e713162e892:

Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20190912a' into staging (2019-09-13 14:37:48 +0100)

are available in the Git repository at:

https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190913

for you to fetch changes up to 27a296fce9821e3608d537756cffa6e43a46df3b:

qemu-ga: Convert invocation documentation to rST (2019-09-13 16:05:01 +0100)

----------------------------------------------------------------
target-arm queue:
* aspeed: add a GPIO controller to the SoC
* aspeed: Various refactorings
* aspeed: Improve DMA controller modelling
* atomic_template: fix indentation in GEN_ATOMIC_HELPER
* qemu-ga: Convert invocation documentation to rST

Quoted 1 line

----------------------------------------------------------------

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.2
for any user-visible changes.

-- PMM