s390/pci: use unique UIDs for domain enumeration
Use UIDs as domain numbers if the UID checking rules apply (in this case the FW guarantees uniqueness of these values). Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
committed by
Martin Schwidefsky
parent
80abb39b50
commit
5c5afd0201
@@ -46,6 +46,8 @@ struct clp_fh_list_entry {
|
|||||||
#define CLP_UTIL_STR_LEN 64
|
#define CLP_UTIL_STR_LEN 64
|
||||||
#define CLP_PFIP_NR_SEGMENTS 4
|
#define CLP_PFIP_NR_SEGMENTS 4
|
||||||
|
|
||||||
|
extern bool zpci_unique_uid;
|
||||||
|
|
||||||
/* List PCI functions request */
|
/* List PCI functions request */
|
||||||
struct clp_req_list_pci {
|
struct clp_req_list_pci {
|
||||||
struct clp_req_hdr hdr;
|
struct clp_req_hdr hdr;
|
||||||
@@ -59,7 +61,8 @@ struct clp_rsp_list_pci {
|
|||||||
u64 resume_token;
|
u64 resume_token;
|
||||||
u32 reserved2;
|
u32 reserved2;
|
||||||
u16 max_fn;
|
u16 max_fn;
|
||||||
u8 reserved3;
|
u8 : 7;
|
||||||
|
u8 uid_checking : 1;
|
||||||
u8 entry_size;
|
u8 entry_size;
|
||||||
struct clp_fh_list_entry fh_list[CLP_FH_LIST_NR_ENTRIES];
|
struct clp_fh_list_entry fh_list[CLP_FH_LIST_NR_ENTRIES];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|||||||
@@ -722,6 +722,11 @@ struct dev_pm_ops pcibios_pm_ops = {
|
|||||||
|
|
||||||
static int zpci_alloc_domain(struct zpci_dev *zdev)
|
static int zpci_alloc_domain(struct zpci_dev *zdev)
|
||||||
{
|
{
|
||||||
|
if (zpci_unique_uid) {
|
||||||
|
zdev->domain = (u16) zdev->uid;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
spin_lock(&zpci_domain_lock);
|
spin_lock(&zpci_domain_lock);
|
||||||
zdev->domain = find_first_zero_bit(zpci_domain, ZPCI_NR_DEVICES);
|
zdev->domain = find_first_zero_bit(zpci_domain, ZPCI_NR_DEVICES);
|
||||||
if (zdev->domain == ZPCI_NR_DEVICES) {
|
if (zdev->domain == ZPCI_NR_DEVICES) {
|
||||||
@@ -735,6 +740,9 @@ static int zpci_alloc_domain(struct zpci_dev *zdev)
|
|||||||
|
|
||||||
static void zpci_free_domain(struct zpci_dev *zdev)
|
static void zpci_free_domain(struct zpci_dev *zdev)
|
||||||
{
|
{
|
||||||
|
if (zpci_unique_uid)
|
||||||
|
return;
|
||||||
|
|
||||||
spin_lock(&zpci_domain_lock);
|
spin_lock(&zpci_domain_lock);
|
||||||
clear_bit(zdev->domain, zpci_domain);
|
clear_bit(zdev->domain, zpci_domain);
|
||||||
spin_unlock(&zpci_domain_lock);
|
spin_unlock(&zpci_domain_lock);
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
#include <asm/clp.h>
|
#include <asm/clp.h>
|
||||||
#include <uapi/asm/clp.h>
|
#include <uapi/asm/clp.h>
|
||||||
|
|
||||||
|
bool zpci_unique_uid;
|
||||||
|
|
||||||
static inline void zpci_err_clp(unsigned int rsp, int rc)
|
static inline void zpci_err_clp(unsigned int rsp, int rc)
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
@@ -315,6 +317,7 @@ static int clp_list_pci(struct clp_req_rsp_list_pci *rrb,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
zpci_unique_uid = rrb->response.uid_checking;
|
||||||
WARN_ON_ONCE(rrb->response.entry_size !=
|
WARN_ON_ONCE(rrb->response.entry_size !=
|
||||||
sizeof(struct clp_fh_list_entry));
|
sizeof(struct clp_fh_list_entry));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user