Skip to content

Commit ebb067d

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 updates from Martin Schwidefsky: "Mostly cleanups and bug-fixes, with two exceptions. The first is lazy flushing of I/O-TLBs for PCI to improve performance, the second is software dirty bits in the pmd for the madvise-free implementation" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (24 commits) s390/locking: Reenable optimistic spinning s390/mm: implement dirty bits for large segment table entries KVM: s390/mm: Fix page table locking vs. split pmd lock s390/dasd: fix camel case s390/3215: fix hanging console issue s390/irq: improve displayed interrupt order in /proc/interrupts s390/seccomp: fix error return for filtered system calls s390/pci: introduce lazy IOTLB flushing for DMA unmap dasd: fix error recovery for alias devices during format dasd: fix list_del corruption during format dasd: fix unresponsive device during format dasd: use aliases for formatted devices during format s390/pci: fix kmsg component s390/kdump: Return NOTIFY_OK for all actions other than MEM_GOING_OFFLINE s390/watchdog: Fix module name in Kconfig help text s390/dasd: replace seq_printf by seq_puts s390/dasd: replace pr_warning by pr_warn s390/dasd: Move EXPORT_SYMBOL after function/variable s390/dasd: remove unnecessary null test before debugfs_remove s390/zfcp: use qdio buffer helpers ...
2 parents 33caee3 + 36e7fda commit ebb067d

26 files changed

Lines changed: 619 additions & 443 deletions

‎Documentation/kernel-parameters.txt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3058,6 +3058,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
30583058

30593059
S [KNL] Run init in single mode
30603060

3061+
s390_iommu= [HW,S390]
3062+
Set s390 IOTLB flushing mode
3063+
strict
3064+
With strict flushing every unmap operation will result in
3065+
an IOTLB flush. Default is lazy flushing before reuse,
3066+
which is faster.
3067+
30613068
sa1100ir [NET]
30623069
See drivers/net/irda/sa1100_ir.c.
30633070

‎arch/s390/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ config S390
9292
select ARCH_INLINE_WRITE_UNLOCK_IRQ
9393
select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
9494
select ARCH_SAVE_PAGE_KEYS if HIBERNATION
95+
select ARCH_SUPPORTS_ATOMIC_RMW
9596
select ARCH_USE_CMPXCHG_LOCKREF
9697
select ARCH_WANT_IPC_PARSE_VERSION
9798
select BUILDTIME_EXTABLE_SORT

‎arch/s390/include/asm/pgtable.h‎

Lines changed: 109 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,14 @@ extern unsigned long MODULES_END;
287287
#define _SEGMENT_ENTRY_INVALID 0x20 /* invalid segment table entry */
288288
#define _SEGMENT_ENTRY_COMMON 0x10 /* common segment bit */
289289
#define _SEGMENT_ENTRY_PTL 0x0f /* page table length */
290-
#define _SEGMENT_ENTRY_NONE _SEGMENT_ENTRY_PROTECT
290+
291+
#define _SEGMENT_ENTRY_DIRTY 0 /* No sw dirty bit for 31-bit */
292+
#define _SEGMENT_ENTRY_YOUNG 0 /* No sw young bit for 31-bit */
293+
#define _SEGMENT_ENTRY_READ 0 /* No sw read bit for 31-bit */
294+
#define _SEGMENT_ENTRY_WRITE 0 /* No sw write bit for 31-bit */
295+
#define _SEGMENT_ENTRY_LARGE 0 /* No large pages for 31-bit */
296+
#define _SEGMENT_ENTRY_BITS_LARGE 0
297+
#define _SEGMENT_ENTRY_ORIGIN_LARGE 0
291298

292299
#define _SEGMENT_ENTRY (_SEGMENT_ENTRY_PTL)
293300
#define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INVALID)
@@ -350,7 +357,7 @@ extern unsigned long MODULES_END;
350357

351358
/* Bits in the segment table entry */
352359
#define _SEGMENT_ENTRY_BITS 0xfffffffffffffe33UL
353-
#define _SEGMENT_ENTRY_BITS_LARGE 0xfffffffffff1ff33UL
360+
#define _SEGMENT_ENTRY_BITS_LARGE 0xfffffffffff0ff33UL
354361
#define _SEGMENT_ENTRY_ORIGIN_LARGE ~0xfffffUL /* large page address */
355362
#define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */
356363
#define _SEGMENT_ENTRY_PROTECT 0x200 /* page protection bit */
@@ -359,30 +366,34 @@ extern unsigned long MODULES_END;
359366
#define _SEGMENT_ENTRY (0)
360367
#define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INVALID)
361368

362-
#define _SEGMENT_ENTRY_LARGE 0x400 /* STE-format control, large page */
363-
#define _SEGMENT_ENTRY_CO 0x100 /* change-recording override */
364-
#define _SEGMENT_ENTRY_SPLIT 0x001 /* THP splitting bit */
365-
#define _SEGMENT_ENTRY_YOUNG 0x002 /* SW segment young bit */
366-
#define _SEGMENT_ENTRY_NONE _SEGMENT_ENTRY_YOUNG
369+
#define _SEGMENT_ENTRY_DIRTY 0x2000 /* SW segment dirty bit */
370+
#define _SEGMENT_ENTRY_YOUNG 0x1000 /* SW segment young bit */
371+
#define _SEGMENT_ENTRY_SPLIT 0x0800 /* THP splitting bit */
372+
#define _SEGMENT_ENTRY_LARGE 0x0400 /* STE-format control, large page */
373+
#define _SEGMENT_ENTRY_CO 0x0100 /* change-recording override */
374+
#define _SEGMENT_ENTRY_READ 0x0002 /* SW segment read bit */
375+
#define _SEGMENT_ENTRY_WRITE 0x0001 /* SW segment write bit */
367376

368377
/*
369378
* Segment table entry encoding (R = read-only, I = invalid, y = young bit):
370-
* ..R...I...y.
371-
* prot-none, old ..0...1...1.
372-
* prot-none, young ..1...1...1.
373-
* read-only, old ..1...1...0.
374-
* read-only, young ..1...0...1.
375-
* read-write, old ..0...1...0.
376-
* read-write, young ..0...0...1.
379+
* dy..R...I...wr
380+
* prot-none, clean, old 00..1...1...00
381+
* prot-none, clean, young 01..1...1...00
382+
* prot-none, dirty, old 10..1...1...00
383+
* prot-none, dirty, young 11..1...1...00
384+
* read-only, clean, old 00..1...1...01
385+
* read-only, clean, young 01..1...0...01
386+
* read-only, dirty, old 10..1...1...01
387+
* read-only, dirty, young 11..1...0...01
388+
* read-write, clean, old 00..1...1...11
389+
* read-write, clean, young 01..1...0...11
390+
* read-write, dirty, old 10..0...1...11
391+
* read-write, dirty, young 11..0...0...11
377392
* The segment table origin is used to distinguish empty (origin==0) from
378393
* read-write, old segment table entries (origin!=0)
379394
*/
380395

381-
#define _SEGMENT_ENTRY_SPLIT_BIT 0 /* THP splitting bit number */
382-
383-
/* Set of bits not changed in pmd_modify */
384-
#define _SEGMENT_CHG_MASK (_SEGMENT_ENTRY_ORIGIN | _SEGMENT_ENTRY_LARGE \
385-
| _SEGMENT_ENTRY_SPLIT | _SEGMENT_ENTRY_CO)
396+
#define _SEGMENT_ENTRY_SPLIT_BIT 11 /* THP splitting bit number */
386397

387398
/* Page status table bits for virtualization */
388399
#define PGSTE_ACC_BITS 0xf000000000000000UL
@@ -455,10 +466,11 @@ extern unsigned long MODULES_END;
455466
* Segment entry (large page) protection definitions.
456467
*/
457468
#define SEGMENT_NONE __pgprot(_SEGMENT_ENTRY_INVALID | \
458-
_SEGMENT_ENTRY_NONE)
459-
#define SEGMENT_READ __pgprot(_SEGMENT_ENTRY_INVALID | \
460469
_SEGMENT_ENTRY_PROTECT)
461-
#define SEGMENT_WRITE __pgprot(_SEGMENT_ENTRY_INVALID)
470+
#define SEGMENT_READ __pgprot(_SEGMENT_ENTRY_PROTECT | \
471+
_SEGMENT_ENTRY_READ)
472+
#define SEGMENT_WRITE __pgprot(_SEGMENT_ENTRY_READ | \
473+
_SEGMENT_ENTRY_WRITE)
462474

463475
static inline int mm_has_pgste(struct mm_struct *mm)
464476
{
@@ -569,25 +581,23 @@ static inline int pmd_none(pmd_t pmd)
569581

570582
static inline int pmd_large(pmd_t pmd)
571583
{
572-
#ifdef CONFIG_64BIT
573584
return (pmd_val(pmd) & _SEGMENT_ENTRY_LARGE) != 0;
574-
#else
575-
return 0;
576-
#endif
577585
}
578586

579-
static inline int pmd_prot_none(pmd_t pmd)
587+
static inline int pmd_pfn(pmd_t pmd)
580588
{
581-
return (pmd_val(pmd) & _SEGMENT_ENTRY_INVALID) &&
582-
(pmd_val(pmd) & _SEGMENT_ENTRY_NONE);
589+
unsigned long origin_mask;
590+
591+
origin_mask = _SEGMENT_ENTRY_ORIGIN;
592+
if (pmd_large(pmd))
593+
origin_mask = _SEGMENT_ENTRY_ORIGIN_LARGE;
594+
return (pmd_val(pmd) & origin_mask) >> PAGE_SHIFT;
583595
}
584596

585597
static inline int pmd_bad(pmd_t pmd)
586598
{
587-
#ifdef CONFIG_64BIT
588599
if (pmd_large(pmd))
589600
return (pmd_val(pmd) & ~_SEGMENT_ENTRY_BITS_LARGE) != 0;
590-
#endif
591601
return (pmd_val(pmd) & ~_SEGMENT_ENTRY_BITS) != 0;
592602
}
593603

@@ -607,20 +617,22 @@ extern int pmdp_clear_flush_young(struct vm_area_struct *vma,
607617
#define __HAVE_ARCH_PMD_WRITE
608618
static inline int pmd_write(pmd_t pmd)
609619
{
610-
if (pmd_prot_none(pmd))
611-
return 0;
612-
return (pmd_val(pmd) & _SEGMENT_ENTRY_PROTECT) == 0;
620+
return (pmd_val(pmd) & _SEGMENT_ENTRY_WRITE) != 0;
621+
}
622+
623+
static inline int pmd_dirty(pmd_t pmd)
624+
{
625+
int dirty = 1;
626+
if (pmd_large(pmd))
627+
dirty = (pmd_val(pmd) & _SEGMENT_ENTRY_DIRTY) != 0;
628+
return dirty;
613629
}
614630

615631
static inline int pmd_young(pmd_t pmd)
616632
{
617-
int young = 0;
618-
#ifdef CONFIG_64BIT
619-
if (pmd_prot_none(pmd))
620-
young = (pmd_val(pmd) & _SEGMENT_ENTRY_PROTECT) != 0;
621-
else
633+
int young = 1;
634+
if (pmd_large(pmd))
622635
young = (pmd_val(pmd) & _SEGMENT_ENTRY_YOUNG) != 0;
623-
#endif
624636
return young;
625637
}
626638

@@ -1391,7 +1403,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
13911403
#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT)
13921404
#define pte_page(x) pfn_to_page(pte_pfn(x))
13931405

1394-
#define pmd_page(pmd) pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)
1406+
#define pmd_page(pmd) pfn_to_page(pmd_pfn(pmd))
13951407

13961408
/* Find an entry in the lowest level page table.. */
13971409
#define pte_offset(pmd, addr) ((pte_t *) pmd_deref(*(pmd)) + pte_index(addr))
@@ -1413,58 +1425,85 @@ static inline unsigned long massage_pgprot_pmd(pgprot_t pgprot)
14131425
return pgprot_val(SEGMENT_WRITE);
14141426
}
14151427

1416-
static inline pmd_t pmd_mkyoung(pmd_t pmd)
1428+
static inline pmd_t pmd_wrprotect(pmd_t pmd)
14171429
{
1418-
#ifdef CONFIG_64BIT
1419-
if (pmd_prot_none(pmd)) {
1430+
pmd_val(pmd) &= ~_SEGMENT_ENTRY_WRITE;
1431+
pmd_val(pmd) |= _SEGMENT_ENTRY_PROTECT;
1432+
return pmd;
1433+
}
1434+
1435+
static inline pmd_t pmd_mkwrite(pmd_t pmd)
1436+
{
1437+
pmd_val(pmd) |= _SEGMENT_ENTRY_WRITE;
1438+
if (pmd_large(pmd) && !(pmd_val(pmd) & _SEGMENT_ENTRY_DIRTY))
1439+
return pmd;
1440+
pmd_val(pmd) &= ~_SEGMENT_ENTRY_PROTECT;
1441+
return pmd;
1442+
}
1443+
1444+
static inline pmd_t pmd_mkclean(pmd_t pmd)
1445+
{
1446+
if (pmd_large(pmd)) {
1447+
pmd_val(pmd) &= ~_SEGMENT_ENTRY_DIRTY;
14201448
pmd_val(pmd) |= _SEGMENT_ENTRY_PROTECT;
1421-
} else {
1449+
}
1450+
return pmd;
1451+
}
1452+
1453+
static inline pmd_t pmd_mkdirty(pmd_t pmd)
1454+
{
1455+
if (pmd_large(pmd)) {
1456+
pmd_val(pmd) |= _SEGMENT_ENTRY_DIRTY;
1457+
if (pmd_val(pmd) & _SEGMENT_ENTRY_WRITE)
1458+
pmd_val(pmd) &= ~_SEGMENT_ENTRY_PROTECT;
1459+
}
1460+
return pmd;
1461+
}
1462+
1463+
static inline pmd_t pmd_mkyoung(pmd_t pmd)
1464+
{
1465+
if (pmd_large(pmd)) {
14221466
pmd_val(pmd) |= _SEGMENT_ENTRY_YOUNG;
1423-
pmd_val(pmd) &= ~_SEGMENT_ENTRY_INVALID;
1467+
if (pmd_val(pmd) & _SEGMENT_ENTRY_READ)
1468+
pmd_val(pmd) &= ~_SEGMENT_ENTRY_INVALID;
14241469
}
1425-
#endif
14261470
return pmd;
14271471
}
14281472

14291473
static inline pmd_t pmd_mkold(pmd_t pmd)
14301474
{
1431-
#ifdef CONFIG_64BIT
1432-
if (pmd_prot_none(pmd)) {
1433-
pmd_val(pmd) &= ~_SEGMENT_ENTRY_PROTECT;
1434-
} else {
1475+
if (pmd_large(pmd)) {
14351476
pmd_val(pmd) &= ~_SEGMENT_ENTRY_YOUNG;
14361477
pmd_val(pmd) |= _SEGMENT_ENTRY_INVALID;
14371478
}
1438-
#endif
14391479
return pmd;
14401480
}
14411481

14421482
static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
14431483
{
1444-
int young;
1445-
1446-
young = pmd_young(pmd);
1447-
pmd_val(pmd) &= _SEGMENT_CHG_MASK;
1484+
if (pmd_large(pmd)) {
1485+
pmd_val(pmd) &= _SEGMENT_ENTRY_ORIGIN_LARGE |
1486+
_SEGMENT_ENTRY_DIRTY | _SEGMENT_ENTRY_YOUNG |
1487+
_SEGMENT_ENTRY_LARGE | _SEGMENT_ENTRY_SPLIT;
1488+
pmd_val(pmd) |= massage_pgprot_pmd(newprot);
1489+
if (!(pmd_val(pmd) & _SEGMENT_ENTRY_DIRTY))
1490+
pmd_val(pmd) |= _SEGMENT_ENTRY_PROTECT;
1491+
if (!(pmd_val(pmd) & _SEGMENT_ENTRY_YOUNG))
1492+
pmd_val(pmd) |= _SEGMENT_ENTRY_INVALID;
1493+
return pmd;
1494+
}
1495+
pmd_val(pmd) &= _SEGMENT_ENTRY_ORIGIN;
14481496
pmd_val(pmd) |= massage_pgprot_pmd(newprot);
1449-
if (young)
1450-
pmd = pmd_mkyoung(pmd);
14511497
return pmd;
14521498
}
14531499

14541500
static inline pmd_t mk_pmd_phys(unsigned long physpage, pgprot_t pgprot)
14551501
{
14561502
pmd_t __pmd;
14571503
pmd_val(__pmd) = physpage + massage_pgprot_pmd(pgprot);
1458-
return pmd_mkyoung(__pmd);
1504+
return __pmd;
14591505
}
14601506

1461-
static inline pmd_t pmd_mkwrite(pmd_t pmd)
1462-
{
1463-
/* Do not clobber PROT_NONE segments! */
1464-
if (!pmd_prot_none(pmd))
1465-
pmd_val(pmd) &= ~_SEGMENT_ENTRY_PROTECT;
1466-
return pmd;
1467-
}
14681507
#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLB_PAGE */
14691508

14701509
static inline void __pmdp_csp(pmd_t *pmdp)
@@ -1555,34 +1594,21 @@ extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);
15551594

15561595
static inline int pmd_trans_splitting(pmd_t pmd)
15571596
{
1558-
return pmd_val(pmd) & _SEGMENT_ENTRY_SPLIT;
1597+
return (pmd_val(pmd) & _SEGMENT_ENTRY_LARGE) &&
1598+
(pmd_val(pmd) & _SEGMENT_ENTRY_SPLIT);
15591599
}
15601600

15611601
static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
15621602
pmd_t *pmdp, pmd_t entry)
15631603
{
1564-
if (!(pmd_val(entry) & _SEGMENT_ENTRY_INVALID) && MACHINE_HAS_EDAT1)
1565-
pmd_val(entry) |= _SEGMENT_ENTRY_CO;
15661604
*pmdp = entry;
15671605
}
15681606

15691607
static inline pmd_t pmd_mkhuge(pmd_t pmd)
15701608
{
15711609
pmd_val(pmd) |= _SEGMENT_ENTRY_LARGE;
1572-
return pmd;
1573-
}
1574-
1575-
static inline pmd_t pmd_wrprotect(pmd_t pmd)
1576-
{
1577-
/* Do not clobber PROT_NONE segments! */
1578-
if (!pmd_prot_none(pmd))
1579-
pmd_val(pmd) |= _SEGMENT_ENTRY_PROTECT;
1580-
return pmd;
1581-
}
1582-
1583-
static inline pmd_t pmd_mkdirty(pmd_t pmd)
1584-
{
1585-
/* No dirty bit in the segment table entry. */
1610+
pmd_val(pmd) |= _SEGMENT_ENTRY_YOUNG;
1611+
pmd_val(pmd) |= _SEGMENT_ENTRY_PROTECT;
15861612
return pmd;
15871613
}
15881614

@@ -1647,11 +1673,6 @@ static inline int has_transparent_hugepage(void)
16471673
{
16481674
return MACHINE_HAS_HPAGE ? 1 : 0;
16491675
}
1650-
1651-
static inline unsigned long pmd_pfn(pmd_t pmd)
1652-
{
1653-
return pmd_val(pmd) >> PAGE_SHIFT;
1654-
}
16551676
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
16561677

16571678
/*

‎arch/s390/include/asm/qdio.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,10 @@ struct qdio_brinfo_entry_l2 {
415415
#define QDIO_FLAG_SYNC_OUTPUT 0x02
416416
#define QDIO_FLAG_PCI_OUT 0x10
417417

418+
int qdio_alloc_buffers(struct qdio_buffer **buf, unsigned int count);
419+
void qdio_free_buffers(struct qdio_buffer **buf, unsigned int count);
420+
void qdio_reset_buffers(struct qdio_buffer **buf, unsigned int count);
421+
418422
extern int qdio_allocate(struct qdio_initialize *);
419423
extern int qdio_establish(struct qdio_initialize *);
420424
extern int qdio_activate(struct ccw_device *);

‎arch/s390/include/asm/syscall.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static inline void syscall_set_return_value(struct task_struct *task,
5454
struct pt_regs *regs,
5555
int error, long val)
5656
{
57-
regs->gprs[2] = error ? -error : val;
57+
regs->gprs[2] = error ? error : val;
5858
}
5959

6060
static inline void syscall_get_arguments(struct task_struct *task,

0 commit comments

Comments
 (0)