Commit e7456f7a authored by Vasily Gorbik's avatar Vasily Gorbik

Merge branch 'fixes' into features

pci and string functions changes on features depend on changes from the
fixes branch.

* fixes:
  s390: add Alexander Gordeev as reviewer
  s390: fix strrchr() implementation
  vfio-ccw: step down as maintainer
  KVM: s390: remove myself as reviewer
  s390/pci: fix zpci_zdev_put() on reserve
  bpf, s390: Fix potential memory leak about jit_data
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parents 1a446b24 8b721643
...@@ -10275,7 +10275,6 @@ KERNEL VIRTUAL MACHINE for s390 (KVM/s390) ...@@ -10275,7 +10275,6 @@ KERNEL VIRTUAL MACHINE for s390 (KVM/s390)
M: Christian Borntraeger <borntraeger@de.ibm.com> M: Christian Borntraeger <borntraeger@de.ibm.com>
M: Janosch Frank <frankja@linux.ibm.com> M: Janosch Frank <frankja@linux.ibm.com>
R: David Hildenbrand <david@redhat.com> R: David Hildenbrand <david@redhat.com>
R: Cornelia Huck <cohuck@redhat.com>
R: Claudio Imbrenda <imbrenda@linux.ibm.com> R: Claudio Imbrenda <imbrenda@linux.ibm.com>
L: kvm@vger.kernel.org L: kvm@vger.kernel.org
S: Supported S: Supported
...@@ -16297,6 +16296,7 @@ S390 ...@@ -16297,6 +16296,7 @@ S390
M: Heiko Carstens <hca@linux.ibm.com> M: Heiko Carstens <hca@linux.ibm.com>
M: Vasily Gorbik <gor@linux.ibm.com> M: Vasily Gorbik <gor@linux.ibm.com>
M: Christian Borntraeger <borntraeger@de.ibm.com> M: Christian Borntraeger <borntraeger@de.ibm.com>
R: Alexander Gordeev <agordeev@linux.ibm.com>
L: linux-s390@vger.kernel.org L: linux-s390@vger.kernel.org
S: Supported S: Supported
W: http://www.ibm.com/developerworks/linux/linux390/ W: http://www.ibm.com/developerworks/linux/linux390/
...@@ -16375,7 +16375,6 @@ F: drivers/s390/crypto/vfio_ap_ops.c ...@@ -16375,7 +16375,6 @@ F: drivers/s390/crypto/vfio_ap_ops.c
F: drivers/s390/crypto/vfio_ap_private.h F: drivers/s390/crypto/vfio_ap_private.h
S390 VFIO-CCW DRIVER S390 VFIO-CCW DRIVER
M: Cornelia Huck <cohuck@redhat.com>
M: Eric Farman <farman@linux.ibm.com> M: Eric Farman <farman@linux.ibm.com>
M: Matthew Rosato <mjrosato@linux.ibm.com> M: Matthew Rosato <mjrosato@linux.ibm.com>
R: Halil Pasic <pasic@linux.ibm.com> R: Halil Pasic <pasic@linux.ibm.com>
......
...@@ -207,6 +207,8 @@ int zpci_enable_device(struct zpci_dev *); ...@@ -207,6 +207,8 @@ int zpci_enable_device(struct zpci_dev *);
int zpci_disable_device(struct zpci_dev *); int zpci_disable_device(struct zpci_dev *);
int zpci_scan_configured_device(struct zpci_dev *zdev, u32 fh); int zpci_scan_configured_device(struct zpci_dev *zdev, u32 fh);
int zpci_deconfigure_device(struct zpci_dev *zdev); int zpci_deconfigure_device(struct zpci_dev *zdev);
void zpci_device_reserved(struct zpci_dev *zdev);
bool zpci_is_device_configured(struct zpci_dev *zdev);
int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64); int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64);
int zpci_unregister_ioat(struct zpci_dev *, u8); int zpci_unregister_ioat(struct zpci_dev *, u8);
......
...@@ -259,14 +259,13 @@ EXPORT_SYMBOL(strcmp); ...@@ -259,14 +259,13 @@ EXPORT_SYMBOL(strcmp);
#ifdef __HAVE_ARCH_STRRCHR #ifdef __HAVE_ARCH_STRRCHR
char *strrchr(const char *s, int c) char *strrchr(const char *s, int c)
{ {
size_t len = __strend(s) - s; ssize_t len = __strend(s) - s;
if (len) do {
do { if (s[len] == (char)c)
if (s[len] == (char) c) return (char *)s + len;
return (char *) s + len; } while (--len >= 0);
} while (--len > 0); return NULL;
return NULL;
} }
EXPORT_SYMBOL(strrchr); EXPORT_SYMBOL(strrchr);
#endif #endif
......
...@@ -1826,7 +1826,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp) ...@@ -1826,7 +1826,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
jit.addrs = kvcalloc(fp->len + 1, sizeof(*jit.addrs), GFP_KERNEL); jit.addrs = kvcalloc(fp->len + 1, sizeof(*jit.addrs), GFP_KERNEL);
if (jit.addrs == NULL) { if (jit.addrs == NULL) {
fp = orig_fp; fp = orig_fp;
goto out; goto free_addrs;
} }
/* /*
* Three initial passes: * Three initial passes:
......
...@@ -92,7 +92,7 @@ void zpci_remove_reserved_devices(void) ...@@ -92,7 +92,7 @@ void zpci_remove_reserved_devices(void)
spin_unlock(&zpci_list_lock); spin_unlock(&zpci_list_lock);
list_for_each_entry_safe(zdev, tmp, &remove, entry) list_for_each_entry_safe(zdev, tmp, &remove, entry)
zpci_zdev_put(zdev); zpci_device_reserved(zdev);
} }
int pci_domain_nr(struct pci_bus *bus) int pci_domain_nr(struct pci_bus *bus)
...@@ -751,6 +751,14 @@ struct zpci_dev *zpci_create_device(u32 fid, u32 fh, enum zpci_state state) ...@@ -751,6 +751,14 @@ struct zpci_dev *zpci_create_device(u32 fid, u32 fh, enum zpci_state state)
return ERR_PTR(rc); return ERR_PTR(rc);
} }
bool zpci_is_device_configured(struct zpci_dev *zdev)
{
enum zpci_state state = zdev->state;
return state != ZPCI_FN_STATE_RESERVED &&
state != ZPCI_FN_STATE_STANDBY;
}
/** /**
* zpci_scan_configured_device() - Scan a freshly configured zpci_dev * zpci_scan_configured_device() - Scan a freshly configured zpci_dev
* @zdev: The zpci_dev to be configured * @zdev: The zpci_dev to be configured
...@@ -822,6 +830,31 @@ int zpci_deconfigure_device(struct zpci_dev *zdev) ...@@ -822,6 +830,31 @@ int zpci_deconfigure_device(struct zpci_dev *zdev)
return 0; return 0;
} }
/**
* zpci_device_reserved() - Mark device as resverved
* @zdev: the zpci_dev that was reserved
*
* Handle the case that a given zPCI function was reserved by another system.
* After a call to this function the zpci_dev can not be found via
* get_zdev_by_fid() anymore but may still be accessible via existing
* references though it will not be functional anymore.
*/
void zpci_device_reserved(struct zpci_dev *zdev)
{
if (zdev->has_hp_slot)
zpci_exit_slot(zdev);
/*
* Remove device from zpci_list as it is going away. This also
* makes sure we ignore subsequent zPCI events for this device.
*/
spin_lock(&zpci_list_lock);
list_del(&zdev->entry);
spin_unlock(&zpci_list_lock);
zdev->state = ZPCI_FN_STATE_RESERVED;
zpci_dbg(3, "rsv fid:%x\n", zdev->fid);
zpci_zdev_put(zdev);
}
void zpci_release_device(struct kref *kref) void zpci_release_device(struct kref *kref)
{ {
struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref); struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref);
...@@ -843,6 +876,12 @@ void zpci_release_device(struct kref *kref) ...@@ -843,6 +876,12 @@ void zpci_release_device(struct kref *kref)
case ZPCI_FN_STATE_STANDBY: case ZPCI_FN_STATE_STANDBY:
if (zdev->has_hp_slot) if (zdev->has_hp_slot)
zpci_exit_slot(zdev); zpci_exit_slot(zdev);
spin_lock(&zpci_list_lock);
list_del(&zdev->entry);
spin_unlock(&zpci_list_lock);
zpci_dbg(3, "rsv fid:%x\n", zdev->fid);
fallthrough;
case ZPCI_FN_STATE_RESERVED:
if (zdev->has_resources) if (zdev->has_resources)
zpci_cleanup_bus_resources(zdev); zpci_cleanup_bus_resources(zdev);
zpci_bus_device_unregister(zdev); zpci_bus_device_unregister(zdev);
...@@ -851,10 +890,6 @@ void zpci_release_device(struct kref *kref) ...@@ -851,10 +890,6 @@ void zpci_release_device(struct kref *kref)
default: default:
break; break;
} }
spin_lock(&zpci_list_lock);
list_del(&zdev->entry);
spin_unlock(&zpci_list_lock);
zpci_dbg(3, "rem fid:%x\n", zdev->fid); zpci_dbg(3, "rem fid:%x\n", zdev->fid);
kfree(zdev); kfree(zdev);
} }
......
...@@ -144,7 +144,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) ...@@ -144,7 +144,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
/* The 0x0304 event may immediately reserve the device */ /* The 0x0304 event may immediately reserve the device */
if (!clp_get_state(zdev->fid, &state) && if (!clp_get_state(zdev->fid, &state) &&
state == ZPCI_FN_STATE_RESERVED) { state == ZPCI_FN_STATE_RESERVED) {
zpci_zdev_put(zdev); zpci_device_reserved(zdev);
} }
} }
break; break;
...@@ -155,7 +155,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) ...@@ -155,7 +155,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
case 0x0308: /* Standby -> Reserved */ case 0x0308: /* Standby -> Reserved */
if (!zdev) if (!zdev)
break; break;
zpci_zdev_put(zdev); zpci_device_reserved(zdev);
break; break;
default: default:
break; break;
......
...@@ -62,14 +62,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -62,14 +62,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
struct zpci_dev *zdev = container_of(hotplug_slot, struct zpci_dev, struct zpci_dev *zdev = container_of(hotplug_slot, struct zpci_dev,
hotplug_slot); hotplug_slot);
switch (zdev->state) { *value = zpci_is_device_configured(zdev) ? 1 : 0;
case ZPCI_FN_STATE_STANDBY:
*value = 0;
break;
default:
*value = 1;
break;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment