Skip to content

Commit 680b5b3

Browse files
committed
Merge tag 'for-linus-5.4-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen fixes from Juergen Gross: - correct panic handling when running as a Xen guest - cleanup the Xen grant driver to remove printing a pointer being always NULL - remove a soon to be wrong call of of_dma_configure() * tag 'for-linus-5.4-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen: Stop abusing DT of_dma_configure API xen/grant-table: remove unnecessary printing x86/xen: Return from panic notifier
2 parents f154988 + ee7f522 commit 680b5b3

File tree

5 files changed

+34
-26
lines changed

5 files changed

+34
-26
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5302,6 +5302,10 @@
53025302
the unplug protocol
53035303
never -- do not unplug even if version check succeeds
53045304

5305+
xen_legacy_crash [X86,XEN]
5306+
Crash from Xen panic notifier, without executing late
5307+
panic() code such as dumping handler.
5308+
53055309
xen_nopvspin [X86,XEN]
53065310
Disables the ticketlock slowpath using Xen PV
53075311
optimizations.

arch/x86/xen/enlighten.c

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,19 +269,41 @@ void xen_reboot(int reason)
269269
BUG();
270270
}
271271

272+
static int reboot_reason = SHUTDOWN_reboot;
273+
static bool xen_legacy_crash;
272274
void xen_emergency_restart(void)
273275
{
274-
xen_reboot(SHUTDOWN_reboot);
276+
xen_reboot(reboot_reason);
275277
}
276278

277279
static int
278280
xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
279281
{
280-
if (!kexec_crash_loaded())
281-
xen_reboot(SHUTDOWN_crash);
282+
if (!kexec_crash_loaded()) {
283+
if (xen_legacy_crash)
284+
xen_reboot(SHUTDOWN_crash);
285+
286+
reboot_reason = SHUTDOWN_crash;
287+
288+
/*
289+
* If panic_timeout==0 then we are supposed to wait forever.
290+
* However, to preserve original dom0 behavior we have to drop
291+
* into hypervisor. (domU behavior is controlled by its
292+
* config file)
293+
*/
294+
if (panic_timeout == 0)
295+
panic_timeout = -1;
296+
}
282297
return NOTIFY_DONE;
283298
}
284299

300+
static int __init parse_xen_legacy_crash(char *arg)
301+
{
302+
xen_legacy_crash = true;
303+
return 0;
304+
}
305+
early_param("xen_legacy_crash", parse_xen_legacy_crash);
306+
285307
static struct notifier_block xen_panic_block = {
286308
.notifier_call = xen_panic_event,
287309
.priority = INT_MIN

drivers/gpu/drm/xen/xen_drm_front.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -718,17 +718,9 @@ static int xen_drv_probe(struct xenbus_device *xb_dev,
718718
struct device *dev = &xb_dev->dev;
719719
int ret;
720720

721-
/*
722-
* The device is not spawn from a device tree, so arch_setup_dma_ops
723-
* is not called, thus leaving the device with dummy DMA ops.
724-
* This makes the device return error on PRIME buffer import, which
725-
* is not correct: to fix this call of_dma_configure() with a NULL
726-
* node to set default DMA ops.
727-
*/
728-
dev->coherent_dma_mask = DMA_BIT_MASK(32);
729-
ret = of_dma_configure(dev, NULL, true);
721+
ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
730722
if (ret < 0) {
731-
DRM_ERROR("Cannot setup DMA ops, ret %d", ret);
723+
DRM_ERROR("Cannot setup DMA mask, ret %d", ret);
732724
return ret;
733725
}
734726

drivers/xen/gntdev.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#define pr_fmt(fmt) "xen:" KBUILD_MODNAME ": " fmt
2424

25+
#include <linux/dma-mapping.h>
2526
#include <linux/module.h>
2627
#include <linux/kernel.h>
2728
#include <linux/init.h>
@@ -34,9 +35,6 @@
3435
#include <linux/slab.h>
3536
#include <linux/highmem.h>
3637
#include <linux/refcount.h>
37-
#ifdef CONFIG_XEN_GRANT_DMA_ALLOC
38-
#include <linux/of_device.h>
39-
#endif
4038

4139
#include <xen/xen.h>
4240
#include <xen/grant_table.h>
@@ -625,14 +623,7 @@ static int gntdev_open(struct inode *inode, struct file *flip)
625623
flip->private_data = priv;
626624
#ifdef CONFIG_XEN_GRANT_DMA_ALLOC
627625
priv->dma_dev = gntdev_miscdev.this_device;
628-
629-
/*
630-
* The device is not spawn from a device tree, so arch_setup_dma_ops
631-
* is not called, thus leaving the device with dummy DMA ops.
632-
* Fix this by calling of_dma_configure() with a NULL node to set
633-
* default DMA ops.
634-
*/
635-
of_dma_configure(priv->dma_dev, NULL, true);
626+
dma_coerce_mask_and_coherent(priv->dma_dev, DMA_BIT_MASK(64));
636627
#endif
637628
pr_debug("priv %p\n", priv);
638629

drivers/xen/grant-table.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,8 +1363,7 @@ static int gnttab_setup(void)
13631363
if (xen_feature(XENFEAT_auto_translated_physmap) && gnttab_shared.addr == NULL) {
13641364
gnttab_shared.addr = xen_auto_xlat_grant_frames.vaddr;
13651365
if (gnttab_shared.addr == NULL) {
1366-
pr_warn("gnttab share frames (addr=0x%08lx) is not mapped!\n",
1367-
(unsigned long)xen_auto_xlat_grant_frames.vaddr);
1366+
pr_warn("gnttab share frames is not mapped!\n");
13681367
return -ENOMEM;
13691368
}
13701369
}

0 commit comments

Comments
 (0)