Skip to content

Commit

Permalink
pci-properties: add properties to enable hotplug for spapr
Browse files Browse the repository at this point in the history
drmgr expects ibm,my-drc-index and ibm,loc-code OF properties in
the corresponding device tree node to determine whether a
pre-populated slot is hotpluggable/unpluggable. This is also
stated as a boot-time requirement for DR-capable devices in SPAPR,
though it does not specify there how these entries are to be generated.

In the case of QEMU, hotpluggable slots are allocated entries based on
bus/slotno values, so we can determine these entries statically at
boot-time, rather than relying on RTAS calls as we would during
OS-driven configuration.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
mdroth committed Nov 20, 2013
1 parent e2e8ac9 commit 2e09a29
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions board-qemu/slof/pci-phb.fs
Expand Up @@ -278,6 +278,7 @@ setup-puid
puid >r \ Save old value of puid
my-puid TO puid \ Set current puid
phb-parse-ranges
1 TO pci-hotplug-enabled
1 0 (probe-pci-host-bridge)
r> TO puid \ Restore previous puid
;
Expand Down
14 changes: 14 additions & 0 deletions slof/fs/pci-properties.fs
Expand Up @@ -589,6 +589,20 @@
dup pci-sub-vendor@ ?dup IF encode-int s" subsystem-vendor-id" property THEN
dup pci-device-assigned-addresses-prop
pci-reg-props
pci-hotplug-enabled IF
\ QEMU uses static assignments for my-drc-index:
\ 40000000h + $bus << 8 + $slot << 3
dup dup pci-addr2bus 8 lshift
swap pci-addr2dev 3 lshift or
40000000 + encode-int s" ibm,my-drc-index" property
\ QEMU uses "Slot $bus*32$slotno" for loc-code
dup dup pci-addr2bus 20 *
swap pci-addr2dev +
a base !
s" Slot " rot $cathex
hex
encode-string s" ibm,loc-code" property
THEN
;

\ set up bridge only properties
Expand Down
2 changes: 2 additions & 0 deletions slof/fs/pci-scan.fs
Expand Up @@ -36,6 +36,8 @@ VARIABLE pci-max-io
\ the 3rd slot on the HostBridge bus
here 100 allot CONSTANT pci-device-vec
0 VALUE pci-device-vec-len
\ enable/disable creation of hotplug-specific properties
0 VALUE pci-hotplug-enabled


\ Fixme Glue to the pci-devices ... remove this later
Expand Down

0 comments on commit 2e09a29

Please sign in to comment.