Skip to content

Commit 5d6a0f4

Browse files
committed
Merge tag 'for-linus-6.0-rc1b-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull more xen updates from Juergen Gross: - fix the handling of the "persistent grants" feature negotiation between Xen blkfront and Xen blkback drivers - a cleanup of xen.config and adding xen.config to Xen section in MAINTAINERS - support HVMOP_set_evtchn_upcall_vector, which is more compliant to "normal" interrupt handling than the global callback used up to now - further small cleanups * tag 'for-linus-6.0-rc1b-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: MAINTAINERS: add xen config fragments to XEN HYPERVISOR sections xen: remove XEN_SCRUB_PAGES in xen.config xen/pciback: Fix comment typo xen/xenbus: fix return type in xenbus_file_read() xen-blkfront: Apply 'feature_persistent' parameter when connect xen-blkback: Apply 'feature_persistent' parameter when connect xen-blkback: fix persistent grants negotiation x86/xen: Add support for HVMOP_set_evtchn_upcall_vector
2 parents 96f86ff + 5ad3134 commit 5d6a0f4

File tree

16 files changed

+116
-36
lines changed

16 files changed

+116
-36
lines changed

Documentation/ABI/testing/sysfs-driver-xen-blkback

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ KernelVersion: 5.10
4242
Contact: Maximilian Heyne <mheyne@amazon.de>
4343
Description:
4444
Whether to enable the persistent grants feature or not. Note
45-
that this option only takes effect on newly created backends.
45+
that this option only takes effect on newly connected backends.
4646
The default is Y (enable).

Documentation/ABI/testing/sysfs-driver-xen-blkfront

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ KernelVersion: 5.10
1515
Contact: Maximilian Heyne <mheyne@amazon.de>
1616
Description:
1717
Whether to enable the persistent grants feature or not. Note
18-
that this option only takes effect on newly created frontends.
18+
that this option only takes effect on newly connected frontends.
1919
The default is Y (enable).

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22200,12 +22200,14 @@ F: drivers/*/xen-*front.c
2220022200
F: drivers/xen/
2220122201
F: include/uapi/xen/
2220222202
F: include/xen/
22203+
F: kernel/configs/xen.config
2220322204

2220422205
XEN HYPERVISOR X86
2220522206
M: Juergen Gross <jgross@suse.com>
2220622207
R: Boris Ostrovsky <boris.ostrovsky@oracle.com>
2220722208
L: xen-devel@lists.xenproject.org (moderated for non-subscribers)
2220822209
S: Supported
22210+
F: arch/x86/configs/xen.config
2220922211
F: arch/x86/include/asm/pvclock-abi.h
2221022212
F: arch/x86/include/asm/xen/
2221122213
F: arch/x86/platform/pvh/

arch/x86/include/asm/xen/cpuid.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@
107107
* ID field from 8 to 15 bits, allowing to target APIC IDs up 32768.
108108
*/
109109
#define XEN_HVM_CPUID_EXT_DEST_ID (1u << 5)
110+
/* Per-vCPU event channel upcalls */
111+
#define XEN_HVM_CPUID_UPCALL_VECTOR (1u << 6)
110112

111113
/*
112114
* Leaf 6 (0x40000x05)

arch/x86/include/asm/xen/events.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static inline int xen_irqs_disabled(struct pt_regs *regs)
2323
/* No need for a barrier -- XCHG is a barrier on x86. */
2424
#define xchg_xen_ulong(ptr, val) xchg((ptr), (val))
2525

26-
extern int xen_have_vector_callback;
26+
extern bool xen_have_vector_callback;
2727

2828
/*
2929
* Events delivered via platform PCI interrupts are always
@@ -34,4 +34,5 @@ static inline bool xen_support_evtchn_rebind(void)
3434
return (!xen_hvm_domain() || xen_have_vector_callback);
3535
}
3636

37+
extern bool xen_percpu_upcall;
3738
#endif /* _ASM_X86_XEN_EVENTS_H */

arch/x86/xen/enlighten.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ EXPORT_SYMBOL_GPL(xen_start_info);
5151

5252
struct shared_info xen_dummy_shared_info;
5353

54-
__read_mostly int xen_have_vector_callback;
54+
__read_mostly bool xen_have_vector_callback = true;
5555
EXPORT_SYMBOL_GPL(xen_have_vector_callback);
5656

5757
/*

arch/x86/xen/enlighten_hvm.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#include <xen/features.h>
1010
#include <xen/events.h>
11+
#include <xen/hvm.h>
12+
#include <xen/interface/hvm/hvm_op.h>
1113
#include <xen/interface/memory.h>
1214

1315
#include <asm/apic.h>
@@ -31,6 +33,9 @@
3133

3234
static unsigned long shared_info_pfn;
3335

36+
__ro_after_init bool xen_percpu_upcall;
37+
EXPORT_SYMBOL_GPL(xen_percpu_upcall);
38+
3439
void xen_hvm_init_shared_info(void)
3540
{
3641
struct xen_add_to_physmap xatp;
@@ -126,6 +131,9 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_xen_hvm_callback)
126131
{
127132
struct pt_regs *old_regs = set_irq_regs(regs);
128133

134+
if (xen_percpu_upcall)
135+
ack_APIC_irq();
136+
129137
inc_irq_stat(irq_hv_callback_count);
130138

131139
xen_hvm_evtchn_do_upcall();
@@ -169,6 +177,15 @@ static int xen_cpu_up_prepare_hvm(unsigned int cpu)
169177
if (!xen_have_vector_callback)
170178
return 0;
171179

180+
if (xen_percpu_upcall) {
181+
rc = xen_set_upcall_vector(cpu);
182+
if (rc) {
183+
WARN(1, "HVMOP_set_evtchn_upcall_vector"
184+
" for CPU %d failed: %d\n", cpu, rc);
185+
return rc;
186+
}
187+
}
188+
172189
if (xen_feature(XENFEAT_hvm_safe_pvclock))
173190
xen_setup_timer(cpu);
174191

@@ -189,8 +206,6 @@ static int xen_cpu_dead_hvm(unsigned int cpu)
189206
return 0;
190207
}
191208

192-
static bool no_vector_callback __initdata;
193-
194209
static void __init xen_hvm_guest_init(void)
195210
{
196211
if (xen_pv_domain())
@@ -213,9 +228,6 @@ static void __init xen_hvm_guest_init(void)
213228

214229
xen_panic_handler_init();
215230

216-
if (!no_vector_callback && xen_feature(XENFEAT_hvm_callback_vector))
217-
xen_have_vector_callback = 1;
218-
219231
xen_hvm_smp_init();
220232
WARN_ON(xen_cpuhp_setup(xen_cpu_up_prepare_hvm, xen_cpu_dead_hvm));
221233
xen_unplug_emulated_devices();
@@ -241,7 +253,7 @@ early_param("xen_nopv", xen_parse_nopv);
241253

242254
static __init int xen_parse_no_vector_callback(char *arg)
243255
{
244-
no_vector_callback = true;
256+
xen_have_vector_callback = false;
245257
return 0;
246258
}
247259
early_param("xen_no_vector_callback", xen_parse_no_vector_callback);

arch/x86/xen/suspend_hvm.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <xen/hvm.h>
66
#include <xen/features.h>
77
#include <xen/interface/features.h>
8+
#include <xen/events.h>
89

910
#include "xen-ops.h"
1011

@@ -14,6 +15,13 @@ void xen_hvm_post_suspend(int suspend_cancelled)
1415
xen_hvm_init_shared_info();
1516
xen_vcpu_restore();
1617
}
17-
xen_setup_callback_vector();
18+
if (xen_percpu_upcall) {
19+
unsigned int cpu;
20+
21+
for_each_online_cpu(cpu)
22+
BUG_ON(xen_set_upcall_vector(cpu));
23+
} else {
24+
xen_setup_callback_vector();
25+
}
1826
xen_unplug_emulated_devices();
1927
}

drivers/block/xen-blkback/xenbus.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ static int xen_blkif_alloc_rings(struct xen_blkif *blkif)
157157
return 0;
158158
}
159159

160+
/* Enable the persistent grants feature. */
161+
static bool feature_persistent = true;
162+
module_param(feature_persistent, bool, 0644);
163+
MODULE_PARM_DESC(feature_persistent, "Enables the persistent grants feature");
164+
160165
static struct xen_blkif *xen_blkif_alloc(domid_t domid)
161166
{
162167
struct xen_blkif *blkif;
@@ -472,12 +477,6 @@ static void xen_vbd_free(struct xen_vbd *vbd)
472477
vbd->bdev = NULL;
473478
}
474479

475-
/* Enable the persistent grants feature. */
476-
static bool feature_persistent = true;
477-
module_param(feature_persistent, bool, 0644);
478-
MODULE_PARM_DESC(feature_persistent,
479-
"Enables the persistent grants feature");
480-
481480
static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
482481
unsigned major, unsigned minor, int readonly,
483482
int cdrom)
@@ -520,8 +519,6 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
520519
if (bdev_max_secure_erase_sectors(bdev))
521520
vbd->discard_secure = true;
522521

523-
vbd->feature_gnt_persistent = feature_persistent;
524-
525522
pr_debug("Successful creation of handle=%04x (dom=%u)\n",
526523
handle, blkif->domid);
527524
return 0;
@@ -1087,10 +1084,9 @@ static int connect_ring(struct backend_info *be)
10871084
xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol);
10881085
return -ENOSYS;
10891086
}
1090-
if (blkif->vbd.feature_gnt_persistent)
1091-
blkif->vbd.feature_gnt_persistent =
1092-
xenbus_read_unsigned(dev->otherend,
1093-
"feature-persistent", 0);
1087+
1088+
blkif->vbd.feature_gnt_persistent = feature_persistent &&
1089+
xenbus_read_unsigned(dev->otherend, "feature-persistent", 0);
10941090

10951091
blkif->vbd.overflow_max_grants = 0;
10961092

drivers/block/xen-blkfront.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,8 +1988,6 @@ static int blkfront_probe(struct xenbus_device *dev,
19881988
info->vdevice = vdevice;
19891989
info->connected = BLKIF_STATE_DISCONNECTED;
19901990

1991-
info->feature_persistent = feature_persistent;
1992-
19931991
/* Front end dir is a number, which is used as the id. */
19941992
info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0);
19951993
dev_set_drvdata(&dev->dev, info);
@@ -2283,7 +2281,7 @@ static void blkfront_gather_backend_features(struct blkfront_info *info)
22832281
if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0))
22842282
blkfront_setup_discard(info);
22852283

2286-
if (info->feature_persistent)
2284+
if (feature_persistent)
22872285
info->feature_persistent =
22882286
!!xenbus_read_unsigned(info->xbdev->otherend,
22892287
"feature-persistent", 0);

0 commit comments

Comments
 (0)