@@ -76,11 +76,6 @@ static enum pci_protocol_version_t pci_protocol_versions[] = {
76
76
PCI_PROTOCOL_VERSION_1_1 ,
77
77
};
78
78
79
- /*
80
- * Protocol version negotiated by hv_pci_protocol_negotiation().
81
- */
82
- static enum pci_protocol_version_t pci_protocol_version ;
83
-
84
79
#define PCI_CONFIG_MMIO_LENGTH 0x2000
85
80
#define CFG_PAGE_OFFSET 0x1000
86
81
#define CFG_PAGE_SIZE (PCI_CONFIG_MMIO_LENGTH - CFG_PAGE_OFFSET)
@@ -462,6 +457,8 @@ enum hv_pcibus_state {
462
457
463
458
struct hv_pcibus_device {
464
459
struct pci_sysdata sysdata ;
460
+ /* Protocol version negotiated with the host */
461
+ enum pci_protocol_version_t protocol_version ;
465
462
enum hv_pcibus_state state ;
466
463
refcount_t remove_lock ;
467
464
struct hv_device * hdev ;
@@ -1225,7 +1222,7 @@ static void hv_irq_unmask(struct irq_data *data)
1225
1222
* negative effect (yet?).
1226
1223
*/
1227
1224
1228
- if (pci_protocol_version >= PCI_PROTOCOL_VERSION_1_2 ) {
1225
+ if (hbus -> protocol_version >= PCI_PROTOCOL_VERSION_1_2 ) {
1229
1226
/*
1230
1227
* PCI_PROTOCOL_VERSION_1_2 supports the VP_SET version of the
1231
1228
* HVCALL_RETARGET_INTERRUPT hypercall, which also coincides
@@ -1395,7 +1392,7 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
1395
1392
ctxt .pci_pkt .completion_func = hv_pci_compose_compl ;
1396
1393
ctxt .pci_pkt .compl_ctxt = & comp ;
1397
1394
1398
- switch (pci_protocol_version ) {
1395
+ switch (hbus -> protocol_version ) {
1399
1396
case PCI_PROTOCOL_VERSION_1_1 :
1400
1397
size = hv_compose_msi_req_v1 (& ctxt .int_pkts .v1 ,
1401
1398
dest ,
@@ -2415,6 +2412,7 @@ static int hv_pci_protocol_negotiation(struct hv_device *hdev,
2415
2412
enum pci_protocol_version_t version [],
2416
2413
int num_version )
2417
2414
{
2415
+ struct hv_pcibus_device * hbus = hv_get_drvdata (hdev );
2418
2416
struct pci_version_request * version_req ;
2419
2417
struct hv_pci_compl comp_pkt ;
2420
2418
struct pci_packet * pkt ;
@@ -2454,10 +2452,10 @@ static int hv_pci_protocol_negotiation(struct hv_device *hdev,
2454
2452
}
2455
2453
2456
2454
if (comp_pkt .completion_status >= 0 ) {
2457
- pci_protocol_version = version [i ];
2455
+ hbus -> protocol_version = version [i ];
2458
2456
dev_info (& hdev -> device ,
2459
2457
"PCI VMBus probing: Using version %#x\n" ,
2460
- pci_protocol_version );
2458
+ hbus -> protocol_version );
2461
2459
goto exit ;
2462
2460
}
2463
2461
@@ -2741,7 +2739,7 @@ static int hv_send_resources_allocated(struct hv_device *hdev)
2741
2739
u32 wslot ;
2742
2740
int ret ;
2743
2741
2744
- size_res = (pci_protocol_version < PCI_PROTOCOL_VERSION_1_2 )
2742
+ size_res = (hbus -> protocol_version < PCI_PROTOCOL_VERSION_1_2 )
2745
2743
? sizeof (* res_assigned ) : sizeof (* res_assigned2 );
2746
2744
2747
2745
pkt = kmalloc (sizeof (* pkt ) + size_res , GFP_KERNEL );
@@ -2760,7 +2758,7 @@ static int hv_send_resources_allocated(struct hv_device *hdev)
2760
2758
pkt -> completion_func = hv_pci_generic_compl ;
2761
2759
pkt -> compl_ctxt = & comp_pkt ;
2762
2760
2763
- if (pci_protocol_version < PCI_PROTOCOL_VERSION_1_2 ) {
2761
+ if (hbus -> protocol_version < PCI_PROTOCOL_VERSION_1_2 ) {
2764
2762
res_assigned =
2765
2763
(struct pci_resources_assigned * )& pkt -> message ;
2766
2764
res_assigned -> message_type .type =
@@ -3200,7 +3198,7 @@ static int hv_pci_resume(struct hv_device *hdev)
3200
3198
return ret ;
3201
3199
3202
3200
/* Only use the version that was in use before hibernation. */
3203
- version [0 ] = pci_protocol_version ;
3201
+ version [0 ] = hbus -> protocol_version ;
3204
3202
ret = hv_pci_protocol_negotiation (hdev , version , 1 );
3205
3203
if (ret )
3206
3204
goto out ;
0 commit comments