Commit 3d647e62 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 's390-4.19-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Martin writes:
  "s390 fixes for 4.19-rc8

   Four more patches for 4.19:
    - Fix resume after suspend-to-disk if resume-CPU != suspend-CPU
    - Fix vfio-ccw check for pinned pages
    - Two patches to avoid a usercopy-whitelist warning in vfio-ccw"

* tag 's390-4.19-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
  s390/cio: Fix how vfio-ccw checks pinned pages
  s390/cio: Refactor alloc of ccw_io_region
  s390/cio: Convert ccw_io_region to pointer
  s390/hibernate: fix error handling when suspend cpu != resume cpu
parents 701f2eb6 7c755449
...@@ -108,7 +108,8 @@ int sclp_early_get_core_info(struct sclp_core_info *info); ...@@ -108,7 +108,8 @@ int sclp_early_get_core_info(struct sclp_core_info *info);
void sclp_early_get_ipl_info(struct sclp_ipl_info *info); void sclp_early_get_ipl_info(struct sclp_ipl_info *info);
void sclp_early_detect(void); void sclp_early_detect(void);
void sclp_early_printk(const char *s); void sclp_early_printk(const char *s);
void __sclp_early_printk(const char *s, unsigned int len); void sclp_early_printk_force(const char *s);
void __sclp_early_printk(const char *s, unsigned int len, unsigned int force);
int _sclp_get_core_info(struct sclp_core_info *info); int _sclp_get_core_info(struct sclp_core_info *info);
int sclp_core_configure(u8 core); int sclp_core_configure(u8 core);
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
static void sclp_early_write(struct console *con, const char *s, unsigned int len) static void sclp_early_write(struct console *con, const char *s, unsigned int len)
{ {
__sclp_early_printk(s, len); __sclp_early_printk(s, len, 0);
} }
static struct console sclp_early_console = { static struct console sclp_early_console = {
......
...@@ -198,12 +198,10 @@ pgm_check_entry: ...@@ -198,12 +198,10 @@ pgm_check_entry:
/* Suspend CPU not available -> panic */ /* Suspend CPU not available -> panic */
larl %r15,init_thread_union larl %r15,init_thread_union
ahi %r15,1<<(PAGE_SHIFT+THREAD_SIZE_ORDER) aghi %r15,1<<(PAGE_SHIFT+THREAD_SIZE_ORDER)
aghi %r15,-STACK_FRAME_OVERHEAD
larl %r2,.Lpanic_string larl %r2,.Lpanic_string
lghi %r1,0 brasl %r14,sclp_early_printk_force
sam31
sigp %r1,%r0,SIGP_SET_ARCHITECTURE
brasl %r14,sclp_early_printk
larl %r3,.Ldisabled_wait_31 larl %r3,.Ldisabled_wait_31
lpsw 0(%r3) lpsw 0(%r3)
4: 4:
......
...@@ -210,11 +210,11 @@ static int sclp_early_setup(int disable, int *have_linemode, int *have_vt220) ...@@ -210,11 +210,11 @@ static int sclp_early_setup(int disable, int *have_linemode, int *have_vt220)
* Output one or more lines of text on the SCLP console (VT220 and / * Output one or more lines of text on the SCLP console (VT220 and /
* or line-mode). * or line-mode).
*/ */
void __sclp_early_printk(const char *str, unsigned int len) void __sclp_early_printk(const char *str, unsigned int len, unsigned int force)
{ {
int have_linemode, have_vt220; int have_linemode, have_vt220;
if (sclp_init_state != sclp_init_state_uninitialized) if (!force && sclp_init_state != sclp_init_state_uninitialized)
return; return;
if (sclp_early_setup(0, &have_linemode, &have_vt220) != 0) if (sclp_early_setup(0, &have_linemode, &have_vt220) != 0)
return; return;
...@@ -227,5 +227,10 @@ void __sclp_early_printk(const char *str, unsigned int len) ...@@ -227,5 +227,10 @@ void __sclp_early_printk(const char *str, unsigned int len)
void sclp_early_printk(const char *str) void sclp_early_printk(const char *str)
{ {
__sclp_early_printk(str, strlen(str)); __sclp_early_printk(str, strlen(str), 0);
}
void sclp_early_printk_force(const char *str)
{
__sclp_early_printk(str, strlen(str), 1);
} }
...@@ -163,7 +163,7 @@ static bool pfn_array_table_iova_pinned(struct pfn_array_table *pat, ...@@ -163,7 +163,7 @@ static bool pfn_array_table_iova_pinned(struct pfn_array_table *pat,
for (i = 0; i < pat->pat_nr; i++, pa++) for (i = 0; i < pat->pat_nr; i++, pa++)
for (j = 0; j < pa->pa_nr; j++) for (j = 0; j < pa->pa_nr; j++)
if (pa->pa_iova_pfn[i] == iova_pfn) if (pa->pa_iova_pfn[j] == iova_pfn)
return true; return true;
return false; return false;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "vfio_ccw_private.h" #include "vfio_ccw_private.h"
struct workqueue_struct *vfio_ccw_work_q; struct workqueue_struct *vfio_ccw_work_q;
struct kmem_cache *vfio_ccw_io_region;
/* /*
* Helpers * Helpers
...@@ -79,7 +80,7 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work) ...@@ -79,7 +80,7 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work)
cp_update_scsw(&private->cp, &irb->scsw); cp_update_scsw(&private->cp, &irb->scsw);
cp_free(&private->cp); cp_free(&private->cp);
} }
memcpy(private->io_region.irb_area, irb, sizeof(*irb)); memcpy(private->io_region->irb_area, irb, sizeof(*irb));
if (private->io_trigger) if (private->io_trigger)
eventfd_signal(private->io_trigger, 1); eventfd_signal(private->io_trigger, 1);
...@@ -114,6 +115,14 @@ static int vfio_ccw_sch_probe(struct subchannel *sch) ...@@ -114,6 +115,14 @@ static int vfio_ccw_sch_probe(struct subchannel *sch)
private = kzalloc(sizeof(*private), GFP_KERNEL | GFP_DMA); private = kzalloc(sizeof(*private), GFP_KERNEL | GFP_DMA);
if (!private) if (!private)
return -ENOMEM; return -ENOMEM;
private->io_region = kmem_cache_zalloc(vfio_ccw_io_region,
GFP_KERNEL | GFP_DMA);
if (!private->io_region) {
kfree(private);
return -ENOMEM;
}
private->sch = sch; private->sch = sch;
dev_set_drvdata(&sch->dev, private); dev_set_drvdata(&sch->dev, private);
...@@ -139,6 +148,7 @@ static int vfio_ccw_sch_probe(struct subchannel *sch) ...@@ -139,6 +148,7 @@ static int vfio_ccw_sch_probe(struct subchannel *sch)
cio_disable_subchannel(sch); cio_disable_subchannel(sch);
out_free: out_free:
dev_set_drvdata(&sch->dev, NULL); dev_set_drvdata(&sch->dev, NULL);
kmem_cache_free(vfio_ccw_io_region, private->io_region);
kfree(private); kfree(private);
return ret; return ret;
} }
...@@ -153,6 +163,7 @@ static int vfio_ccw_sch_remove(struct subchannel *sch) ...@@ -153,6 +163,7 @@ static int vfio_ccw_sch_remove(struct subchannel *sch)
dev_set_drvdata(&sch->dev, NULL); dev_set_drvdata(&sch->dev, NULL);
kmem_cache_free(vfio_ccw_io_region, private->io_region);
kfree(private); kfree(private);
return 0; return 0;
...@@ -232,10 +243,20 @@ static int __init vfio_ccw_sch_init(void) ...@@ -232,10 +243,20 @@ static int __init vfio_ccw_sch_init(void)
if (!vfio_ccw_work_q) if (!vfio_ccw_work_q)
return -ENOMEM; return -ENOMEM;
vfio_ccw_io_region = kmem_cache_create_usercopy("vfio_ccw_io_region",
sizeof(struct ccw_io_region), 0,
SLAB_ACCOUNT, 0,
sizeof(struct ccw_io_region), NULL);
if (!vfio_ccw_io_region) {
destroy_workqueue(vfio_ccw_work_q);
return -ENOMEM;
}
isc_register(VFIO_CCW_ISC); isc_register(VFIO_CCW_ISC);
ret = css_driver_register(&vfio_ccw_sch_driver); ret = css_driver_register(&vfio_ccw_sch_driver);
if (ret) { if (ret) {
isc_unregister(VFIO_CCW_ISC); isc_unregister(VFIO_CCW_ISC);
kmem_cache_destroy(vfio_ccw_io_region);
destroy_workqueue(vfio_ccw_work_q); destroy_workqueue(vfio_ccw_work_q);
} }
...@@ -246,6 +267,7 @@ static void __exit vfio_ccw_sch_exit(void) ...@@ -246,6 +267,7 @@ static void __exit vfio_ccw_sch_exit(void)
{ {
css_driver_unregister(&vfio_ccw_sch_driver); css_driver_unregister(&vfio_ccw_sch_driver);
isc_unregister(VFIO_CCW_ISC); isc_unregister(VFIO_CCW_ISC);
kmem_cache_destroy(vfio_ccw_io_region);
destroy_workqueue(vfio_ccw_work_q); destroy_workqueue(vfio_ccw_work_q);
} }
module_init(vfio_ccw_sch_init); module_init(vfio_ccw_sch_init);
......
...@@ -93,13 +93,13 @@ static void fsm_io_error(struct vfio_ccw_private *private, ...@@ -93,13 +93,13 @@ static void fsm_io_error(struct vfio_ccw_private *private,
enum vfio_ccw_event event) enum vfio_ccw_event event)
{ {
pr_err("vfio-ccw: FSM: I/O request from state:%d\n", private->state); pr_err("vfio-ccw: FSM: I/O request from state:%d\n", private->state);
private->io_region.ret_code = -EIO; private->io_region->ret_code = -EIO;
} }
static void fsm_io_busy(struct vfio_ccw_private *private, static void fsm_io_busy(struct vfio_ccw_private *private,
enum vfio_ccw_event event) enum vfio_ccw_event event)
{ {
private->io_region.ret_code = -EBUSY; private->io_region->ret_code = -EBUSY;
} }
static void fsm_disabled_irq(struct vfio_ccw_private *private, static void fsm_disabled_irq(struct vfio_ccw_private *private,
...@@ -126,7 +126,7 @@ static void fsm_io_request(struct vfio_ccw_private *private, ...@@ -126,7 +126,7 @@ static void fsm_io_request(struct vfio_ccw_private *private,
{ {
union orb *orb; union orb *orb;
union scsw *scsw = &private->scsw; union scsw *scsw = &private->scsw;
struct ccw_io_region *io_region = &private->io_region; struct ccw_io_region *io_region = private->io_region;
struct mdev_device *mdev = private->mdev; struct mdev_device *mdev = private->mdev;
char *errstr = "request"; char *errstr = "request";
......
...@@ -174,7 +174,7 @@ static ssize_t vfio_ccw_mdev_read(struct mdev_device *mdev, ...@@ -174,7 +174,7 @@ static ssize_t vfio_ccw_mdev_read(struct mdev_device *mdev,
return -EINVAL; return -EINVAL;
private = dev_get_drvdata(mdev_parent_dev(mdev)); private = dev_get_drvdata(mdev_parent_dev(mdev));
region = &private->io_region; region = private->io_region;
if (copy_to_user(buf, (void *)region + *ppos, count)) if (copy_to_user(buf, (void *)region + *ppos, count))
return -EFAULT; return -EFAULT;
...@@ -196,7 +196,7 @@ static ssize_t vfio_ccw_mdev_write(struct mdev_device *mdev, ...@@ -196,7 +196,7 @@ static ssize_t vfio_ccw_mdev_write(struct mdev_device *mdev,
if (private->state != VFIO_CCW_STATE_IDLE) if (private->state != VFIO_CCW_STATE_IDLE)
return -EACCES; return -EACCES;
region = &private->io_region; region = private->io_region;
if (copy_from_user((void *)region + *ppos, buf, count)) if (copy_from_user((void *)region + *ppos, buf, count))
return -EFAULT; return -EFAULT;
......
...@@ -41,7 +41,7 @@ struct vfio_ccw_private { ...@@ -41,7 +41,7 @@ struct vfio_ccw_private {
atomic_t avail; atomic_t avail;
struct mdev_device *mdev; struct mdev_device *mdev;
struct notifier_block nb; struct notifier_block nb;
struct ccw_io_region io_region; struct ccw_io_region *io_region;
struct channel_program cp; struct channel_program cp;
struct irb irb; struct irb irb;
......
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