Commit 31764f1b authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus-20191129' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
 "I wasn't going to send this one off so soon, but unfortunately one of
  the fixes from the previous pull broke the build on some archs. So I'm
  sending this sooner rather than later. This contains:

   - Add highmem.h include for io_uring, because of the kmap() additions
     from last round. For some reason the build bot didn't spot this
     even though it sat for days.

   - Three minor ';' removals

   - Add support for the Beurer CD-on-a-chip device

   - Make io_uring work on MMU-less archs"

* tag 'for-linus-20191129' of git://git.kernel.dk/linux-block:
  io_uring: fix missing kmap() declaration on powerpc
  ataflop: Remove unneeded semicolon
  block: sunvdc: Remove unneeded semicolon
  drbd: Remove unneeded semicolon
  io_uring: add mapping support for NOMMU archs
  sr_vendor: support Beurer GL50 evo CD-on-a-chip devices.
  cdrom: respect device capabilities during opening action
parents 67b8ed29 aa4c3967
...@@ -857,7 +857,7 @@ static void fd_calibrate( void ) ...@@ -857,7 +857,7 @@ static void fd_calibrate( void )
} }
if (ATARIHW_PRESENT(FDCSPEED)) if (ATARIHW_PRESENT(FDCSPEED))
dma_wd.fdc_speed = 0; /* always seek with 8 Mhz */; dma_wd.fdc_speed = 0; /* always seek with 8 Mhz */
DPRINT(("fd_calibrate\n")); DPRINT(("fd_calibrate\n"));
SET_IRQ_HANDLER( fd_calibrate_done ); SET_IRQ_HANDLER( fd_calibrate_done );
/* we can't verify, since the speed may be incorrect */ /* we can't verify, since the speed may be incorrect */
......
...@@ -884,7 +884,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what, ...@@ -884,7 +884,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
start_new_tl_epoch(connection); start_new_tl_epoch(connection);
mod_rq_state(req, m, 0, RQ_NET_OK|RQ_NET_DONE); mod_rq_state(req, m, 0, RQ_NET_OK|RQ_NET_DONE);
break; break;
}; }
return rv; return rv;
} }
......
...@@ -634,7 +634,7 @@ static int generic_request(struct vdc_port *port, u8 op, void *buf, int len) ...@@ -634,7 +634,7 @@ static int generic_request(struct vdc_port *port, u8 op, void *buf, int len)
case VD_OP_GET_EFI: case VD_OP_GET_EFI:
case VD_OP_SET_EFI: case VD_OP_SET_EFI:
return -EOPNOTSUPP; return -EOPNOTSUPP;
}; }
map_perm |= LDC_MAP_SHADOW | LDC_MAP_DIRECT | LDC_MAP_IO; map_perm |= LDC_MAP_SHADOW | LDC_MAP_DIRECT | LDC_MAP_IO;
......
...@@ -996,6 +996,12 @@ static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype *tracks) ...@@ -996,6 +996,12 @@ static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype *tracks)
tracks->xa = 0; tracks->xa = 0;
tracks->error = 0; tracks->error = 0;
cd_dbg(CD_COUNT_TRACKS, "entering cdrom_count_tracks\n"); cd_dbg(CD_COUNT_TRACKS, "entering cdrom_count_tracks\n");
if (!CDROM_CAN(CDC_PLAY_AUDIO)) {
tracks->error = CDS_NO_INFO;
return;
}
/* Grab the TOC header so we can see how many tracks there are */ /* Grab the TOC header so we can see how many tracks there are */
ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCHDR, &header); ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCHDR, &header);
if (ret) { if (ret) {
...@@ -1162,7 +1168,8 @@ int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev, ...@@ -1162,7 +1168,8 @@ int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev,
ret = open_for_data(cdi); ret = open_for_data(cdi);
if (ret) if (ret)
goto err; goto err;
cdrom_mmc3_profile(cdi); if (CDROM_CAN(CDC_GENERIC_PACKET))
cdrom_mmc3_profile(cdi);
if (mode & FMODE_WRITE) { if (mode & FMODE_WRITE) {
ret = -EROFS; ret = -EROFS;
if (cdrom_open_write(cdi)) if (cdrom_open_write(cdi))
...@@ -2882,6 +2889,9 @@ int cdrom_get_last_written(struct cdrom_device_info *cdi, long *last_written) ...@@ -2882,6 +2889,9 @@ int cdrom_get_last_written(struct cdrom_device_info *cdi, long *last_written)
it doesn't give enough information or fails. then we return it doesn't give enough information or fails. then we return
the toc contents. */ the toc contents. */
use_toc: use_toc:
if (!CDROM_CAN(CDC_PLAY_AUDIO))
return -ENOSYS;
toc.cdte_format = CDROM_MSF; toc.cdte_format = CDROM_MSF;
toc.cdte_track = CDROM_LEADOUT; toc.cdte_track = CDROM_LEADOUT;
if ((ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCENTRY, &toc))) if ((ret = cdi->ops->audio_ioctl(cdi, CDROMREADTOCENTRY, &toc)))
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
#define VENDOR_NEC 2 #define VENDOR_NEC 2
#define VENDOR_TOSHIBA 3 #define VENDOR_TOSHIBA 3
#define VENDOR_WRITER 4 /* pre-scsi3 writers */ #define VENDOR_WRITER 4 /* pre-scsi3 writers */
#define VENDOR_CYGNAL_85ED 5 /* CD-on-a-chip */
#define VENDOR_TIMEOUT 30*HZ #define VENDOR_TIMEOUT 30*HZ
...@@ -99,6 +100,23 @@ void sr_vendor_init(Scsi_CD *cd) ...@@ -99,6 +100,23 @@ void sr_vendor_init(Scsi_CD *cd)
} else if (!strncmp(vendor, "TOSHIBA", 7)) { } else if (!strncmp(vendor, "TOSHIBA", 7)) {
cd->vendor = VENDOR_TOSHIBA; cd->vendor = VENDOR_TOSHIBA;
} else if (!strncmp(vendor, "Beurer", 6) &&
!strncmp(model, "Gluco Memory", 12)) {
/* The Beurer GL50 evo uses a Cygnal-manufactured CD-on-a-chip
that only accepts a subset of SCSI commands. Most of the
not-implemented commands are fine to fail, but a few,
particularly around the MMC or Audio commands, will put the
device into an unrecoverable state, so they need to be
avoided at all costs.
*/
cd->vendor = VENDOR_CYGNAL_85ED;
cd->cdi.mask |= (
CDC_MULTI_SESSION |
CDC_CLOSE_TRAY | CDC_OPEN_TRAY |
CDC_LOCK |
CDC_GENERIC_PACKET |
CDC_PLAY_AUDIO
);
} }
#endif #endif
} }
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
#include <linux/nospec.h> #include <linux/nospec.h>
#include <linux/sizes.h> #include <linux/sizes.h>
#include <linux/hugetlb.h> #include <linux/hugetlb.h>
#include <linux/highmem.h>
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
#include <trace/events/io_uring.h> #include <trace/events/io_uring.h>
...@@ -4469,12 +4470,11 @@ static int io_uring_flush(struct file *file, void *data) ...@@ -4469,12 +4470,11 @@ static int io_uring_flush(struct file *file, void *data)
return 0; return 0;
} }
static int io_uring_mmap(struct file *file, struct vm_area_struct *vma) static void *io_uring_validate_mmap_request(struct file *file,
loff_t pgoff, size_t sz)
{ {
loff_t offset = (loff_t) vma->vm_pgoff << PAGE_SHIFT;
unsigned long sz = vma->vm_end - vma->vm_start;
struct io_ring_ctx *ctx = file->private_data; struct io_ring_ctx *ctx = file->private_data;
unsigned long pfn; loff_t offset = pgoff << PAGE_SHIFT;
struct page *page; struct page *page;
void *ptr; void *ptr;
...@@ -4487,17 +4487,59 @@ static int io_uring_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -4487,17 +4487,59 @@ static int io_uring_mmap(struct file *file, struct vm_area_struct *vma)
ptr = ctx->sq_sqes; ptr = ctx->sq_sqes;
break; break;
default: default:
return -EINVAL; return ERR_PTR(-EINVAL);
} }
page = virt_to_head_page(ptr); page = virt_to_head_page(ptr);
if (sz > page_size(page)) if (sz > page_size(page))
return -EINVAL; return ERR_PTR(-EINVAL);
return ptr;
}
#ifdef CONFIG_MMU
static int io_uring_mmap(struct file *file, struct vm_area_struct *vma)
{
size_t sz = vma->vm_end - vma->vm_start;
unsigned long pfn;
void *ptr;
ptr = io_uring_validate_mmap_request(file, vma->vm_pgoff, sz);
if (IS_ERR(ptr))
return PTR_ERR(ptr);
pfn = virt_to_phys(ptr) >> PAGE_SHIFT; pfn = virt_to_phys(ptr) >> PAGE_SHIFT;
return remap_pfn_range(vma, vma->vm_start, pfn, sz, vma->vm_page_prot); return remap_pfn_range(vma, vma->vm_start, pfn, sz, vma->vm_page_prot);
} }
#else /* !CONFIG_MMU */
static int io_uring_mmap(struct file *file, struct vm_area_struct *vma)
{
return vma->vm_flags & (VM_SHARED | VM_MAYSHARE) ? 0 : -EINVAL;
}
static unsigned int io_uring_nommu_mmap_capabilities(struct file *file)
{
return NOMMU_MAP_DIRECT | NOMMU_MAP_READ | NOMMU_MAP_WRITE;
}
static unsigned long io_uring_nommu_get_unmapped_area(struct file *file,
unsigned long addr, unsigned long len,
unsigned long pgoff, unsigned long flags)
{
void *ptr;
ptr = io_uring_validate_mmap_request(file, pgoff, len);
if (IS_ERR(ptr))
return PTR_ERR(ptr);
return (unsigned long) ptr;
}
#endif /* !CONFIG_MMU */
SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
u32, min_complete, u32, flags, const sigset_t __user *, sig, u32, min_complete, u32, flags, const sigset_t __user *, sig,
size_t, sigsz) size_t, sigsz)
...@@ -4568,6 +4610,10 @@ static const struct file_operations io_uring_fops = { ...@@ -4568,6 +4610,10 @@ static const struct file_operations io_uring_fops = {
.release = io_uring_release, .release = io_uring_release,
.flush = io_uring_flush, .flush = io_uring_flush,
.mmap = io_uring_mmap, .mmap = io_uring_mmap,
#ifndef CONFIG_MMU
.get_unmapped_area = io_uring_nommu_get_unmapped_area,
.mmap_capabilities = io_uring_nommu_mmap_capabilities,
#endif
.poll = io_uring_poll, .poll = io_uring_poll,
.fasync = io_uring_fasync, .fasync = io_uring_fasync,
}; };
......
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