Skip to content

Commit

Permalink
updateInterface: enable hot-add nic on arm64
Browse files Browse the repository at this point in the history
For now, update interface in agent will fail when hot-add
nic to a running containers on arm64 as rescan pci bus will
occur between up hf and bf of shpc hotplug interrupt handling.

Another problem is that as pcie bridge is used when create vm
for arm64, the rootBusPath will be
"/devices/platform/4010000000.pcie/pci0000:00".

This patch remove the implementation of rescan and change the
rootBusPath for arm64.

Fixes: kata-containers#544
Signed-off-by: Jianyong Wu <[email protected]>
  • Loading branch information
jongwu committed Apr 30, 2019
1 parent c61d54f commit fb7d025
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 10 deletions.
10 changes: 0 additions & 10 deletions device.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,8 @@ const (
driverLocalType = "local"
)

const (
rootBusPath = "/devices/pci0000:00"
pciBusMode = 0220
)

var (
sysBusPrefix = sysfsDir + "/bus/pci/devices"
pciBusRescanFile = sysfsDir + "/bus/pci/rescan"
pciBusPathFormat = "%s/%s/pci_bus/"
systemDevPath = "/dev"
)
Expand All @@ -68,10 +62,6 @@ var deviceHandlerList = map[string]deviceHandler{
driverNvdimmType: nvdimmDeviceHandler,
}

func rescanPciBus() error {
return ioutil.WriteFile(pciBusRescanFile, []byte{'1'}, pciBusMode)
}

// getDevicePCIAddress fetches the complete PCI address in sysfs, based on the PCI
// identifier provided. This should be in the format: "bridgeAddr/deviceAddr".
// Here, bridgeAddr is the address at which the brige is attached on the root bus,
Expand Down
20 changes: 20 additions & 0 deletions device_amd64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Copyright (c) 2019 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//

package main

import "ioutil"

const (
rootBusPath = "/devices/pci0000:00"
pciBusMode = 0220
)

var pciBusRescanFile = sysfsDir + "/bus/pci/rescan"

func rescanPciBus() error {
return ioutil.WriteFile(pciBusRescanFile, []byte{'1'}, pciBusMode)
}
13 changes: 13 additions & 0 deletions device_arm64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Copyright (c) 2019 ARM Limited
//
// SPDX-License-Identifier: Apache-2.0
//

package main

const rootBusPath = "/devices/platform/4010000000.pcie/pci0000:00"

func rescanPciBus() error {
return nil
}
20 changes: 20 additions & 0 deletions device_ppc64le.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Copyright (c) 2019 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//

package main

import "ioutil"

const (
rootBusPath = "/devices/pci0000:00"
pciBusMode = 0220
)

var pciBusRescanFile = sysfsDir + "/bus/pci/rescan"

func rescanPciBus() error {
return ioutil.WriteFile(pciBusRescanFile, []byte{'1'}, pciBusMode)
}
20 changes: 20 additions & 0 deletions device_s390x.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Copyright (c) 2019 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//

package main

import "ioutil"

const (
rootBusPath = "/devices/pci0000:00"
pciBusMode = 0220
)

var pciBusRescanFile = sysfsDir + "/bus/pci/rescan"

func rescanPciBus() error {
return ioutil.WriteFile(pciBusRescanFile, []byte{'1'}, pciBusMode)
}

0 comments on commit fb7d025

Please sign in to comment.