All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC v4 5/6] pci_expander_bridge: Add ioport for pxb host bus
@ 2018-08-09  6:35 Zihan Yang
  2018-08-17 17:51 ` Marcel Apfelbaum
  0 siblings, 1 reply; 3+ messages in thread
From: Zihan Yang @ 2018-08-09  6:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Zihan Yang, Michael S. Tsirkin, Marcel Apfelbaum

This enables seabios to read config file in pxb host bus other than sysbus

Signed-off-by: Zihan Yang <whois.zihan.yang@gmail.com>
---
 hw/pci-bridge/pci_expander_bridge.c         | 15 +++++++++++++++
 include/hw/pci-bridge/pci_expander_bridge.h |  3 +++
 2 files changed, 18 insertions(+)

diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
index c685c75..686b026 100644
--- a/hw/pci-bridge/pci_expander_bridge.c
+++ b/hw/pci-bridge/pci_expander_bridge.c
@@ -234,6 +234,20 @@ static void pxb_pcie_host_initfn(Object *obj)
                          qdev_prop_allow_set_link_before_realize, 0, NULL);
 }
 
+static void pxb_pcie_host_realize(DeviceState *dev, Error **errp)
+{
+    PCIHostState *pci = PCI_HOST_BRIDGE(dev);
+    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+
+    // FIX ME! Use specific port number for pxb-pcie host bridge, not scalable!
+    /* port layout is | pxb1_cmd | pxb1_data | pxb2_cmd | pxb2_data | ... | */
+    sysbus_add_io(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_ADDR_BASE, &pci->conf_mem);
+    sysbus_init_ioports(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_ADDR_BASE + g_list_length(pxb_dev_list) * 8, 4);
+
+    sysbus_add_io(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_DATA_BASE, &pci->data_mem);
+    sysbus_init_ioports(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_DATA_BASE + g_list_length(pxb_dev_list) * 8, 4);
+}
+
 static Property pxb_pcie_host_props[] = {
     DEFINE_PROP_UINT64(PCIE_HOST_MCFG_BASE, PXBPCIEHost, parent_obj.base_addr,
                         PCIE_BASE_ADDR_UNMAPPED),
@@ -262,6 +276,7 @@ static void pxb_pcie_host_class_init(ObjectClass *class, void *data)
 
     dc->fw_name = "pcie";
     dc->props = pxb_pcie_host_props;
+    dc->realize = pxb_pcie_host_realize;
     /* Reason: Internal part of the pxb/pxb-pcie device, not usable by itself */
     dc->user_creatable = false;
     sbc->explicit_ofw_unit_address = pxb_host_ofw_unit_address;
diff --git a/include/hw/pci-bridge/pci_expander_bridge.h b/include/hw/pci-bridge/pci_expander_bridge.h
index 1119210..e6d3b67 100644
--- a/include/hw/pci-bridge/pci_expander_bridge.h
+++ b/include/hw/pci-bridge/pci_expander_bridge.h
@@ -7,6 +7,9 @@
 #define PROP_PXB_PCIE_DOMAIN_NR "domain_nr"
 #define PROP_PXB_BUS_NR "bus_nr"
 
+#define PXB_PCIE_HOST_BRIDGE_CONFIG_ADDR_BASE 0x1000
+#define PXB_PCIE_HOST_BRIDGE_CONFIG_DATA_BASE 0x1004
+
 uint64_t pxb_pcie_mcfg_hole(void);
 
 #endif
-- 
2.7.4

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

* Re: [Qemu-devel] [RFC v4 5/6] pci_expander_bridge: Add ioport for pxb host bus
  2018-08-09  6:35 [Qemu-devel] [RFC v4 5/6] pci_expander_bridge: Add ioport for pxb host bus Zihan Yang
@ 2018-08-17 17:51 ` Marcel Apfelbaum
  2018-08-19  2:01   ` Zihan Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Apfelbaum @ 2018-08-17 17:51 UTC (permalink / raw)
  To: Zihan Yang, qemu-devel; +Cc: Michael S. Tsirkin



On 08/09/2018 09:35 AM, Zihan Yang wrote:
> This enables seabios to read config file in pxb host bus other than sysbus
>
> Signed-off-by: Zihan Yang <whois.zihan.yang@gmail.com>
> ---
>   hw/pci-bridge/pci_expander_bridge.c         | 15 +++++++++++++++
>   include/hw/pci-bridge/pci_expander_bridge.h |  3 +++
>   2 files changed, 18 insertions(+)
>
> diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
> index c685c75..686b026 100644
> --- a/hw/pci-bridge/pci_expander_bridge.c
> +++ b/hw/pci-bridge/pci_expander_bridge.c
> @@ -234,6 +234,20 @@ static void pxb_pcie_host_initfn(Object *obj)
>                            qdev_prop_allow_set_link_before_realize, 0, NULL);
>   }
>   
> +static void pxb_pcie_host_realize(DeviceState *dev, Error **errp)
> +{
> +    PCIHostState *pci = PCI_HOST_BRIDGE(dev);
> +    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
> +
> +    // FIX ME! Use specific port number for pxb-pcie host bridge, not scalable!
> +    /* port layout is | pxb1_cmd | pxb1_data | pxb2_cmd | pxb2_data | ... | */
> +    sysbus_add_io(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_ADDR_BASE, &pci->conf_mem);
> +    sysbus_init_ioports(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_ADDR_BASE + g_list_length(pxb_dev_list) * 8, 4);
> +
> +    sysbus_add_io(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_DATA_BASE, &pci->data_mem);
> +    sysbus_init_ioports(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_DATA_BASE + g_list_length(pxb_dev_list) * 8, 4);

Why do we need this functionality? Can't we access the pxb-pcie config 
space only with
MMCFG?

Thanks,
Marcel

> +}
> +
>   static Property pxb_pcie_host_props[] = {
>       DEFINE_PROP_UINT64(PCIE_HOST_MCFG_BASE, PXBPCIEHost, parent_obj.base_addr,
>                           PCIE_BASE_ADDR_UNMAPPED),
> @@ -262,6 +276,7 @@ static void pxb_pcie_host_class_init(ObjectClass *class, void *data)
>   
>       dc->fw_name = "pcie";
>       dc->props = pxb_pcie_host_props;
> +    dc->realize = pxb_pcie_host_realize;
>       /* Reason: Internal part of the pxb/pxb-pcie device, not usable by itself */
>       dc->user_creatable = false;
>       sbc->explicit_ofw_unit_address = pxb_host_ofw_unit_address;
> diff --git a/include/hw/pci-bridge/pci_expander_bridge.h b/include/hw/pci-bridge/pci_expander_bridge.h
> index 1119210..e6d3b67 100644
> --- a/include/hw/pci-bridge/pci_expander_bridge.h
> +++ b/include/hw/pci-bridge/pci_expander_bridge.h
> @@ -7,6 +7,9 @@
>   #define PROP_PXB_PCIE_DOMAIN_NR "domain_nr"
>   #define PROP_PXB_BUS_NR "bus_nr"
>   
> +#define PXB_PCIE_HOST_BRIDGE_CONFIG_ADDR_BASE 0x1000
> +#define PXB_PCIE_HOST_BRIDGE_CONFIG_DATA_BASE 0x1004
> +
>   uint64_t pxb_pcie_mcfg_hole(void);
>   
>   #endif

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

* Re: [Qemu-devel] [RFC v4 5/6] pci_expander_bridge: Add ioport for pxb host bus
  2018-08-17 17:51 ` Marcel Apfelbaum
@ 2018-08-19  2:01   ` Zihan Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Zihan Yang @ 2018-08-19  2:01 UTC (permalink / raw)
  To: Marcel Apfelbaum; +Cc: qemu-devel, Michael S. Tsirkin

Marcel Apfelbaum <marcel.apfelbaum@gmail.com> 于2018年8月18日周六 上午1:52写道:
>
>
>
> On 08/09/2018 09:35 AM, Zihan Yang wrote:
> > This enables seabios to read config file in pxb host bus other than sysbus
> >
> > Signed-off-by: Zihan Yang <whois.zihan.yang@gmail.com>
> > ---
> >   hw/pci-bridge/pci_expander_bridge.c         | 15 +++++++++++++++
> >   include/hw/pci-bridge/pci_expander_bridge.h |  3 +++
> >   2 files changed, 18 insertions(+)
> >
> > diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
> > index c685c75..686b026 100644
> > --- a/hw/pci-bridge/pci_expander_bridge.c
> > +++ b/hw/pci-bridge/pci_expander_bridge.c
> > @@ -234,6 +234,20 @@ static void pxb_pcie_host_initfn(Object *obj)
> >                            qdev_prop_allow_set_link_before_realize, 0, NULL);
> >   }
> >
> > +static void pxb_pcie_host_realize(DeviceState *dev, Error **errp)
> > +{
> > +    PCIHostState *pci = PCI_HOST_BRIDGE(dev);
> > +    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
> > +
> > +    // FIX ME! Use specific port number for pxb-pcie host bridge, not scalable!
> > +    /* port layout is | pxb1_cmd | pxb1_data | pxb2_cmd | pxb2_data | ... | */
> > +    sysbus_add_io(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_ADDR_BASE, &pci->conf_mem);
> > +    sysbus_init_ioports(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_ADDR_BASE + g_list_length(pxb_dev_list) * 8, 4);
> > +
> > +    sysbus_add_io(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_DATA_BASE, &pci->data_mem);
> > +    sysbus_init_ioports(sbd, PXB_PCIE_HOST_BRIDGE_CONFIG_DATA_BASE + g_list_length(pxb_dev_list) * 8, 4);
>
> Why do we need this functionality? Can't we access the pxb-pcie config
> space only with
> MMCFG?

This is for the same reason as mentioned in previous patch.

> Thanks,
> Marcel
>
> > +}
> > +
> >   static Property pxb_pcie_host_props[] = {
> >       DEFINE_PROP_UINT64(PCIE_HOST_MCFG_BASE, PXBPCIEHost, parent_obj.base_addr,
> >                           PCIE_BASE_ADDR_UNMAPPED),
> > @@ -262,6 +276,7 @@ static void pxb_pcie_host_class_init(ObjectClass *class, void *data)
> >
> >       dc->fw_name = "pcie";
> >       dc->props = pxb_pcie_host_props;
> > +    dc->realize = pxb_pcie_host_realize;
> >       /* Reason: Internal part of the pxb/pxb-pcie device, not usable by itself */
> >       dc->user_creatable = false;
> >       sbc->explicit_ofw_unit_address = pxb_host_ofw_unit_address;
> > diff --git a/include/hw/pci-bridge/pci_expander_bridge.h b/include/hw/pci-bridge/pci_expander_bridge.h
> > index 1119210..e6d3b67 100644
> > --- a/include/hw/pci-bridge/pci_expander_bridge.h
> > +++ b/include/hw/pci-bridge/pci_expander_bridge.h
> > @@ -7,6 +7,9 @@
> >   #define PROP_PXB_PCIE_DOMAIN_NR "domain_nr"
> >   #define PROP_PXB_BUS_NR "bus_nr"
> >
> > +#define PXB_PCIE_HOST_BRIDGE_CONFIG_ADDR_BASE 0x1000
> > +#define PXB_PCIE_HOST_BRIDGE_CONFIG_DATA_BASE 0x1004
> > +
> >   uint64_t pxb_pcie_mcfg_hole(void);
> >
> >   #endif
>

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

end of thread, other threads:[~2018-08-19  2:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-09  6:35 [Qemu-devel] [RFC v4 5/6] pci_expander_bridge: Add ioport for pxb host bus Zihan Yang
2018-08-17 17:51 ` Marcel Apfelbaum
2018-08-19  2:01   ` Zihan Yang

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.