Re: [PATCH v3 1/3] spapr: nvdimm: Forward declare and move the definitions
David Gibson <[email protected]>
| Newsgroups | org.01.lists.linux-nvdimm,dev.linux.lists.nvdimm,org.kernel.vger.kvm-ppc,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Mar 23, 2021 at 09:47:23AM -0400, Shivaprasad G Bhat wrote: > The subsequent patches add definitions which tend to > get the compilation to cyclic dependency. So, prepare > with forward declarations, move the defitions and clean up. > > Signed-off-by: Shivaprasad G Bhat <[email protected]> > --- > hw/ppc/spapr_nvdimm.c | 12 ++++++++++++ > include/hw/ppc/spapr_nvdimm.h | 21 ++++++--------------- > 2 files changed, 18 insertions(+), 15 deletions(-) > > diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c > index b46c36917c..8cf3fb2ffb 100644 > --- a/hw/ppc/spapr_nvdimm.c > +++ b/hw/ppc/spapr_nvdimm.c > @@ -31,6 +31,18 @@ > #include "qemu/range.h" > #include "hw/ppc/spapr_numa.h" > > +/* > + * The nvdimm size should be aligned to SCM block size. > + * The SCM block size should be aligned to SPAPR_MEMORY_BLOCK_SIZE > + * inorder to have SCM regions not to overlap with dimm memory regions. > + * The SCM devices can have variable block sizes. For now, fixing the > + * block size to the minimum value. > + */ > +#define SPAPR_MINIMUM_SCM_BLOCK_SIZE SPAPR_MEMORY_BLOCK_SIZE > + > +/* Have an explicit check for alignment */ > +QEMU_BUILD_BUG_ON(SPAPR_MINIMUM_SCM_BLOCK_SIZE % SPAPR_MEMORY_BLOCK_SIZE); > + > bool spapr_nvdimm_validate(HotplugHandler *hotplug_dev, NVDIMMDevice *nvdimm, > uint64_t size, Error **errp) > { > diff --git a/include/hw/ppc/spapr_nvdimm.h b/include/hw/ppc/spapr_nvdimm.h > index 73be250e2a..abcacda5d7 100644 > --- a/include/hw/ppc/spapr_nvdimm.h > +++ b/include/hw/ppc/spapr_nvdimm.h > @@ -11,23 +11,14 @@ > #define HW_SPAPR_NVDIMM_H > > #include "hw/mem/nvdimm.h" > -#include "hw/ppc/spapr.h" > > -/* > - * The nvdimm size should be aligned to SCM block size. > - * The SCM block size should be aligned to SPAPR_MEMORY_BLOCK_SIZE > - * inorder to have SCM regions not to overlap with dimm memory regions. > - * The SCM devices can have variable block sizes. For now, fixing the > - * block size to the minimum value. > - */ > -#define SPAPR_MINIMUM_SCM_BLOCK_SIZE SPAPR_MEMORY_BLOCK_SIZE > - > -/* Have an explicit check for alignment */ > -QEMU_BUILD_BUG_ON(SPAPR_MINIMUM_SCM_BLOCK_SIZE % SPAPR_MEMORY_BLOCK_SIZE); > +struct SpaprDrc; > +struct SpaprMachineState; > > -int spapr_pmem_dt_populate(SpaprDrc *drc, SpaprMachineState *spapr, > - void *fdt, int *fdt_start_offset, Error **errp); > -void spapr_dt_persistent_memory(SpaprMachineState *spapr, void *fdt); > +int spapr_pmem_dt_populate(struct SpaprDrc *drc, Using explicit struct tags is against qemu coding style. You should put a typedef on the forward decl so you don't need to do it here (see examples in spapr_pci.c amongst other places). > + struct SpaprMachineState *spapr, void *fdt, > + int *fdt_start_offset, Error **errp); > +void spapr_dt_persistent_memory(struct SpaprMachineState *spapr, void *fdt); > bool spapr_nvdimm_validate(HotplugHandler *hotplug_dev, NVDIMMDevice *nvdimm, > uint64_t size, Error **errp); > void spapr_add_nvdimm(DeviceState *dev, uint64_t slot); > > -- 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 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAmBapF0ACgkQbDjKyiDZ s5IwcQ/+P4QE5ojDn80wASGJfTSW9l9uXbiCfTxa0qeq7rPAYB5U70laqSN1mhmz UxOymyhs5BWED2BuOWrDi+yJm1OBh4za1yKwR7pqqvBth2uyeOYsZo8V7K2jn3Kb nvnz4M5GtOCUaE4ASYAlGYWf5GCG6sBBSuEWfySkTQvSXYZPUdvX7icOU6k09ZXO tV5p9SxSxm9JdYniHZW5U0EJJdc9DEEMRxdhHdHRhbW34JQcOjjlOmHaEVjTXl0P rXMiSaCj7pfV4RZbzwiGAGoBtdGfMF7mmKFN3rZLWLpsXp3TTPwIAir1DINjxWn6 wbL9bTUAv2YRSZ1eDVLEvpG0SHx79L49GxhghURsgJfe5NtxkdIWuRMAIUjgw31O 2+Q0eXMcSkv4ZlqERk+aWBC11nIgquP43iXuVM7577x1rsRSdZw4T4rFrT0RMTTw /nUeNA79nZImZZjkjM1xv4GiVkajT+ySF17Oy38izLyiV4zBgGzRhTtgDIHOQb8d ZiUY5zgHdMdtucGPRpgQGKPaVEdjyR6y8gOAi26iyj1bZXUl1b36E7B7KRP6udWu W3vt4H1ZMfqTj5gL1sqgx6TILaKyYzvm9AqKEHjSeWM3b3yAYZxH9QA3Tew0QEb/ UhBm/IpHchKX+i3S5yTYrCKPx3hmDR05hnjrevMucHwsGHtZ3vY= =fwKz -----END PGP SIGNATURE-----