diff mbox

[RFC,3/7] s390x/sclp: properly guard pci-specific functions

Message ID 20170707122159.24714-4-cohuck@redhat.com
State New
Headers show

Commit Message

Cornelia Huck July 7, 2017, 12:21 p.m. UTC
For non-pci builds, pci reconfiguration via sclp is not available.
Don't indicate it in the sclp facilities and return an invalid
command if the guest tries to issue pci configure/deconfigure.

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
 hw/s390x/sclp.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index 83d6023894..d20baa3bbd 100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -59,6 +59,7 @@  static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
     int rnsize, rnmax;
     int slots = MIN(machine->ram_slots, s390_get_memslot_count(kvm_state));
     IplParameterBlock *ipib = s390_ipl_get_iplb();
+    uint64_t sclp_facilities = SCLP_HAS_CPU_INFO;
 
     CPU_FOREACH(cpu) {
         cpu_count++;
@@ -79,8 +80,10 @@  static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
 
     prepare_cpu_entries(sclp, read_info->entries, cpu_count);
 
-    read_info->facilities = cpu_to_be64(SCLP_HAS_CPU_INFO |
-                                        SCLP_HAS_PCI_RECONFIG);
+#ifdef CONFIG_PCI
+    sclp_facilities |= SCLP_HAS_PCI_RECONFIG;
+#endif
+    read_info->facilities = cpu_to_be64(sclp_facilities);
 
     /* Memory Hotplug is only supported for the ccw machine type */
     if (mhd) {
@@ -386,10 +389,18 @@  static void sclp_execute(SCLPDevice *sclp, SCCB *sccb, uint32_t code)
         sclp_c->unassign_storage(sclp, sccb);
         break;
     case SCLP_CMDW_CONFIGURE_PCI:
+#ifdef CONFIG_PCI
         s390_pci_sclp_configure(sccb);
+#else
+        sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND);
+#endif
         break;
     case SCLP_CMDW_DECONFIGURE_PCI:
-        s390_pci_sclp_deconfigure(sccb);
+#ifdef CONFIG_PCI
+        sclp_c->pci_sclp_deconfigure(sccb);
+#else
+        sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND);
+#endif
         break;
     default:
         efc->command_handler(ef, sccb, code);