diff options
author | kaiw <kaiw@FreeBSD.org> | 2014-01-28 19:12:31 +0000 |
---|---|---|
committer | kaiw <kaiw@FreeBSD.org> | 2014-01-28 19:12:31 +0000 |
commit | 9c3c6fdae0b43f1bbd5486754c20e403fc83c3b6 (patch) | |
tree | c000f1bf7a21df619e5cc1ac52b3edc991b884d0 /sys | |
parent | 0fb1cfad9518e33fe20de1d9d694d0d5c2044fa2 (diff) | |
parent | 17e24564634134c9b7145fcf8d1c7d51b93c3182 (diff) | |
download | FreeBSD-src-9c3c6fdae0b43f1bbd5486754c20e403fc83c3b6.zip FreeBSD-src-9c3c6fdae0b43f1bbd5486754c20e403fc83c3b6.tar.gz |
MFH@261240.
Diffstat (limited to 'sys')
77 files changed, 213 insertions, 179 deletions
diff --git a/sys/amd64/amd64/db_disasm.c b/sys/amd64/amd64/db_disasm.c index b229909..a8d91eb 100644 --- a/sys/amd64/amd64/db_disasm.c +++ b/sys/amd64/amd64/db_disasm.c @@ -1353,6 +1353,16 @@ db_disasm(loc, altfmt) i_size = NONE; i_mode = 0; break; + case 0xca: + i_name = "clac"; + i_size = NONE; + i_mode = 0; + break; + case 0xcb: + i_name = "stac"; + i_size = NONE; + i_mode = 0; + break; case 0xd0: i_name = "xgetbv"; i_size = NONE; diff --git a/sys/amd64/include/vmm.h b/sys/amd64/include/vmm.h index 2f39f21..cc7c7ad 100644 --- a/sys/amd64/include/vmm.h +++ b/sys/amd64/include/vmm.h @@ -298,6 +298,7 @@ enum vm_exitcode { VM_EXITCODE_SPINUP_AP, VM_EXITCODE_SPINDOWN_CPU, VM_EXITCODE_RENDEZVOUS, + VM_EXITCODE_IOAPIC_EOI, VM_EXITCODE_MAX }; @@ -354,6 +355,9 @@ struct vm_exit { struct { uint64_t rflags; } hlt; + struct { + int vector; + } ioapic_eoi; } u; }; diff --git a/sys/amd64/vmm/intel/vmcs.h b/sys/amd64/vmm/intel/vmcs.h index 8c8231c..08e07e7 100644 --- a/sys/amd64/vmm/intel/vmcs.h +++ b/sys/amd64/vmm/intel/vmcs.h @@ -136,6 +136,7 @@ vmcs_write(uint32_t encoding, uint64_t val) #define VMCS_EOI_EXIT1 0x0000201E #define VMCS_EOI_EXIT2 0x00002020 #define VMCS_EOI_EXIT3 0x00002022 +#define VMCS_EOI_EXIT(vector) (VMCS_EOI_EXIT0 + ((vector) / 64) * 2) /* 64-bit read-only fields */ #define VMCS_GUEST_PHYSICAL_ADDRESS 0x00002400 @@ -318,6 +319,7 @@ vmcs_write(uint32_t encoding, uint64_t val) #define EXIT_REASON_MCE 41 #define EXIT_REASON_TPR 43 #define EXIT_REASON_APIC_ACCESS 44 +#define EXIT_REASON_VIRTUALIZED_EOI 45 #define EXIT_REASON_GDTR_IDTR 46 #define EXIT_REASON_LDTR_TR 47 #define EXIT_REASON_EPT_FAULT 48 diff --git a/sys/amd64/vmm/intel/vmx.c b/sys/amd64/vmm/intel/vmx.c index 68d940b..e31fbde 100644 --- a/sys/amd64/vmm/intel/vmx.c +++ b/sys/amd64/vmm/intel/vmx.c @@ -1726,6 +1726,11 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) (qual & EXIT_QUAL_NMIUDTI) != 0) vmx_restore_nmi_blocking(vmx, vcpu); break; + case EXIT_REASON_VIRTUALIZED_EOI: + vmexit->exitcode = VM_EXITCODE_IOAPIC_EOI; + vmexit->u.ioapic_eoi.vector = qual & 0xFF; + vmexit->inst_length = 0; /* trap-like */ + break; case EXIT_REASON_APIC_ACCESS: handled = vmx_handle_apic_access(vmx, vcpu, vmexit); break; @@ -2320,6 +2325,7 @@ vmx_setcap(void *arg, int vcpu, int type, int val) struct vlapic_vtx { struct vlapic vlapic; struct pir_desc *pir_desc; + struct vmx *vmx; }; #define VMX_CTR_PIR(vm, vcpuid, pir_desc, notify, vector, level, msg) \ @@ -2345,9 +2351,6 @@ vmx_set_intr_ready(struct vlapic *vlapic, int vector, bool level) uint64_t mask; int idx, notify; - /* - * XXX need to deal with level triggered interrupts - */ vlapic_vtx = (struct vlapic_vtx *)vlapic; pir_desc = vlapic_vtx->pir_desc; @@ -2422,6 +2425,33 @@ vmx_intr_accepted(struct vlapic *vlapic, int vector) } static void +vmx_set_tmr(struct vlapic *vlapic, int vector, bool level) +{ + struct vlapic_vtx *vlapic_vtx; + struct vmx *vmx; + struct vmcs *vmcs; + uint64_t mask, val; + + KASSERT(vector >= 0 && vector <= 255, ("invalid vector %d", vector)); + KASSERT(!vcpu_is_running(vlapic->vm, vlapic->vcpuid, NULL), + ("vmx_set_tmr: vcpu cannot be running")); + + vlapic_vtx = (struct vlapic_vtx *)vlapic; + vmx = vlapic_vtx->vmx; + vmcs = &vmx->vmcs[vlapic->vcpuid]; + mask = 1UL << (vector % 64); + + VMPTRLD(vmcs); + val = vmcs_read(VMCS_EOI_EXIT(vector)); + if (level) + val |= mask; + else + val &= ~mask; + vmcs_write(VMCS_EOI_EXIT(vector), val); + VMCLEAR(vmcs); +} + +static void vmx_post_intr(struct vlapic *vlapic, int hostcpu) { @@ -2519,11 +2549,13 @@ vmx_vlapic_init(void *arg, int vcpuid) vlapic_vtx = (struct vlapic_vtx *)vlapic; vlapic_vtx->pir_desc = &vmx->pir_desc[vcpuid]; + vlapic_vtx->vmx = vmx; if (virtual_interrupt_delivery) { vlapic->ops.set_intr_ready = vmx_set_intr_ready; vlapic->ops.pending_intr = vmx_pending_intr; vlapic->ops.intr_accepted = vmx_intr_accepted; + vlapic->ops.set_tmr = vmx_set_tmr; } if (posted_interrupts) diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c index c6b2718..2395247 100644 --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -1300,6 +1300,7 @@ vlapic_reset(struct vlapic *vlapic) lapic->dfr = 0xffffffff; lapic->svr = APIC_SVR_VECTOR; vlapic_mask_lvts(vlapic); + vlapic_reset_tmr(vlapic); lapic->dcr_timer = 0; vlapic_dcr_write_handler(vlapic); @@ -1457,32 +1458,42 @@ vlapic_enabled(struct vlapic *vlapic) return (false); } +static void +vlapic_set_tmr(struct vlapic *vlapic, int vector, bool level) +{ + struct LAPIC *lapic; + uint32_t *tmrptr, mask; + int idx; + + lapic = vlapic->apic_page; + tmrptr = &lapic->tmr0; + idx = (vector / 32) * 4; + mask = 1 << (vector % 32); + if (level) + tmrptr[idx] |= mask; + else + tmrptr[idx] &= ~mask; + + if (vlapic->ops.set_tmr != NULL) + (*vlapic->ops.set_tmr)(vlapic, vector, level); +} + void vlapic_reset_tmr(struct vlapic *vlapic) { - struct LAPIC *lapic; + int vector; VLAPIC_CTR0(vlapic, "vlapic resetting all vectors to edge-triggered"); - lapic = vlapic->apic_page; - lapic->tmr0 = 0; - lapic->tmr1 = 0; - lapic->tmr2 = 0; - lapic->tmr3 = 0; - lapic->tmr4 = 0; - lapic->tmr5 = 0; - lapic->tmr6 = 0; - lapic->tmr7 = 0; + for (vector = 0; vector <= 255; vector++) + vlapic_set_tmr(vlapic, vector, false); } void vlapic_set_tmr_level(struct vlapic *vlapic, uint32_t dest, bool phys, int delmode, int vector) { - struct LAPIC *lapic; - uint32_t *tmrptr, mask; cpuset_t dmask; - int idx; bool lowprio; KASSERT(vector >= 0 && vector <= 255, ("invalid vector %d", vector)); @@ -1502,11 +1513,6 @@ vlapic_set_tmr_level(struct vlapic *vlapic, uint32_t dest, bool phys, if (!CPU_ISSET(vlapic->vcpuid, &dmask)) return; - lapic = vlapic->apic_page; - tmrptr = &lapic->tmr0; - idx = (vector / 32) * 4; - mask = 1 << (vector % 32); - tmrptr[idx] |= mask; - VLAPIC_CTR1(vlapic, "vector %d set to level-triggered", vector); + vlapic_set_tmr(vlapic, vector, true); } diff --git a/sys/amd64/vmm/io/vlapic_priv.h b/sys/amd64/vmm/io/vlapic_priv.h index 0ee30b2..a4e96aa 100644 --- a/sys/amd64/vmm/io/vlapic_priv.h +++ b/sys/amd64/vmm/io/vlapic_priv.h @@ -139,6 +139,7 @@ struct vlapic_ops { int (*pending_intr)(struct vlapic *vlapic, int *vecptr); void (*intr_accepted)(struct vlapic *vlapic, int vector); void (*post_intr)(struct vlapic *vlapic, int hostcpu); + void (*set_tmr)(struct vlapic *vlapic, int vector, bool level); }; struct vlapic { diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c index 95a1e1c..4759881 100644 --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -1150,6 +1150,10 @@ restart: if (error == 0) { retu = false; switch (vme->exitcode) { + case VM_EXITCODE_IOAPIC_EOI: + vioapic_process_eoi(vm, vcpuid, + vme->u.ioapic_eoi.vector); + break; case VM_EXITCODE_RENDEZVOUS: vm_handle_rendezvous(vm, vcpuid); error = 0; diff --git a/sys/arm/allwinner/a20/std.a20 b/sys/arm/allwinner/a20/std.a20 index 851308c..f582e91 100644 --- a/sys/arm/allwinner/a20/std.a20 +++ b/sys/arm/allwinner/a20/std.a20 @@ -16,8 +16,6 @@ options KERNPHYSADDR=0x40200000 makeoptions KERNVIRTADDR=0xc0200000 options KERNVIRTADDR=0xc0200000 -options STARTUP_PAGETABLE_ADDR=0x48000000 - options ARM_L2_PIPT options IPI_IRQ_START=0 diff --git a/sys/arm/allwinner/std.a10 b/sys/arm/allwinner/std.a10 index f698b34..11ef732 100644 --- a/sys/arm/allwinner/std.a10 +++ b/sys/arm/allwinner/std.a10 @@ -16,6 +16,4 @@ options KERNPHYSADDR=0x40200000 makeoptions KERNVIRTADDR=0xc0200000 options KERNVIRTADDR=0xc0200000 -options STARTUP_PAGETABLE_ADDR=0x48000000 - files "../allwinner/files.a10" diff --git a/sys/arm/arm/db_trace.c b/sys/arm/arm/db_trace.c index 57119da..af661f31 100644 --- a/sys/arm/arm/db_trace.c +++ b/sys/arm/arm/db_trace.c @@ -269,7 +269,7 @@ db_unwind_exec_insn(struct unwind_state *state) /* Stop processing */ state->entries = 0; - } else if ((insn == INSN_POP_REGS)) { + } else if (insn == INSN_POP_REGS) { unsigned int mask, reg; mask = db_unwind_exec_read_byte(state); diff --git a/sys/arm/arm/locore.S b/sys/arm/arm/locore.S index 209839a..5b38494 100644 --- a/sys/arm/arm/locore.S +++ b/sys/arm/arm/locore.S @@ -144,9 +144,15 @@ disable_mmu: nop mov pc, r7 Lunmapped: -#ifdef STARTUP_PAGETABLE_ADDR - /* build page table from scratch */ - ldr r0, Lstartup_pagetable + /* + * Build page table from scratch. + */ + + /* Load the page tables physical address */ + ldr r1, Lstartup_pagetable + ldr r2, =(KERNVIRTADDR - KERNPHYSADDR) + sub r0, r1, r2 + adr r4, mmu_init_table b 3f @@ -197,7 +203,6 @@ Lunmapped: nop CPWAIT(r0) -#endif mmu_done: nop adr r1, .Lstart @@ -231,7 +236,6 @@ virt_done: adr r0, .Lmainreturned b _C_LABEL(panic) /* NOTREACHED */ -#ifdef STARTUP_PAGETABLE_ADDR #define MMU_INIT(va,pa,n_sec,attr) \ .word n_sec ; \ .word 4*((va)>>L1_S_SHIFT) ; \ @@ -246,7 +250,7 @@ Lreal_start: Lend: .word _edata Lstartup_pagetable: - .word STARTUP_PAGETABLE_ADDR + .word pagetable #ifdef SMP Lstartup_pagetable_secondary: .word temp_pagetable @@ -272,10 +276,9 @@ mmu_init_table: MMU_INIT(0x48000000, 0x48000000, 1, L1_TYPE_S|L1_SHARED|L1_S_C|L1_S_AP(AP_KRW)) #endif /* SMP */ .word 0 /* end of table */ -#endif .Lstart: .word _edata - .word _end + .word _ebss .word svcstk + INIT_ARM_STACK_SIZE .Lvirt_done: @@ -293,6 +296,15 @@ mmu_init_table: svcstk: .space INIT_ARM_STACK_SIZE +/* + * Memory for the initial pagetable. We are unable to place this in + * the bss as this will be cleared after the table is loaded. + */ + .section ".init_pagetable" + .align 14 /* 16KiB aligned */ +pagetable: + .space L1_TABLE_SIZE + .text .align 0 diff --git a/sys/arm/at91/at91.c b/sys/arm/at91/at91.c index fbd7bf2..0ad4888 100644 --- a/sys/arm/at91/at91.c +++ b/sys/arm/at91/at91.c @@ -65,11 +65,13 @@ at91_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flags, pa = trunc_page(bpa); if (pa >= AT91_PA_BASE + 0xff00000) { - *bshp = pa - AT91_PA_BASE + AT91_BASE; + *bshp = bpa - AT91_PA_BASE + AT91_BASE; return (0); } - if (pa >= AT91_BASE + 0xff00000) + if (pa >= AT91_BASE + 0xff00000) { + *bshp = bpa; return (0); + } endpa = round_page(bpa + size); *bshp = (vm_offset_t)pmap_mapdev(pa, endpa - pa); diff --git a/sys/arm/at91/board_sam9260ek.c b/sys/arm/at91/board_sam9260ek.c index 96c822f..e3210af 100644 --- a/sys/arm/at91/board_sam9260ek.c +++ b/sys/arm/at91/board_sam9260ek.c @@ -83,7 +83,7 @@ bi_dbgu(void) } static void -bi_emac() +bi_emac(void) { /* diff --git a/sys/arm/at91/std.bwct b/sys/arm/at91/std.bwct index 6cb7ddd..19e5356 100644 --- a/sys/arm/at91/std.bwct +++ b/sys/arm/at91/std.bwct @@ -1,7 +1,6 @@ #$FreeBSD$ include "../at91/std.at91" -options STARTUP_PAGETABLE_ADDR=0x20800000 makeoptions KERNPHYSADDR=0x20000000 options KERNPHYSADDR=0x20000000 makeoptions KERNVIRTADDR=0xc0000000 diff --git a/sys/arm/at91/std.eb9200 b/sys/arm/at91/std.eb9200 index c1dcd2a..cc8f70f 100644 --- a/sys/arm/at91/std.eb9200 +++ b/sys/arm/at91/std.eb9200 @@ -1,7 +1,6 @@ #$FreeBSD$ include "../at91/std.at91" -options STARTUP_PAGETABLE_ADDR=0x20800000 makeoptions KERNPHYSADDR=0x20000000 options KERNPHYSADDR=0x20000000 makeoptions KERNVIRTADDR=0xc0000000 diff --git a/sys/arm/at91/std.ethernut5 b/sys/arm/at91/std.ethernut5 index 876b59a..7793a83 100644 --- a/sys/arm/at91/std.ethernut5 +++ b/sys/arm/at91/std.ethernut5 @@ -1,7 +1,6 @@ # $FreeBSD$ include "../at91/std.at91sam9" -options STARTUP_PAGETABLE_ADDR=0x20800000 makeoptions KERNPHYSADDR=0x20000000 makeoptions KERNVIRTADDR=0xc0000000 options KERNPHYSADDR=0x20000000 diff --git a/sys/arm/at91/std.hl200 b/sys/arm/at91/std.hl200 index f48f723..5b5ed22 100644 --- a/sys/arm/at91/std.hl200 +++ b/sys/arm/at91/std.hl200 @@ -1,7 +1,6 @@ #$FreeBSD$ include "../at91/std.at91" -options STARTUP_PAGETABLE_ADDR=0x20000000 makeoptions KERNPHYSADDR=0x20100000 options KERNPHYSADDR=0x20100000 makeoptions KERNVIRTADDR=0xc0100000 diff --git a/sys/arm/at91/std.hl201 b/sys/arm/at91/std.hl201 index ff27308..6537b27 100644 --- a/sys/arm/at91/std.hl201 +++ b/sys/arm/at91/std.hl201 @@ -1,7 +1,6 @@ #$FreeBSD$ include "../at91/std.at91sam9" -options STARTUP_PAGETABLE_ADDR=0x20800000 makeoptions KERNPHYSADDR=0x20000000 makeoptions KERNVIRTADDR=0xc0000000 options KERNPHYSADDR=0x20000000 diff --git a/sys/arm/at91/std.kb920x b/sys/arm/at91/std.kb920x index 85c8d03..2f52db5 100644 --- a/sys/arm/at91/std.kb920x +++ b/sys/arm/at91/std.kb920x @@ -1,7 +1,6 @@ #$FreeBSD$ include "../at91/std.at91" -options STARTUP_PAGETABLE_ADDR=0x20800000 makeoptions KERNPHYSADDR=0x20000000 options KERNPHYSADDR=0x20000000 makeoptions KERNVIRTADDR=0xc0000000 diff --git a/sys/arm/at91/std.qila9g20 b/sys/arm/at91/std.qila9g20 index e2043b6..f9dbb5f 100644 --- a/sys/arm/at91/std.qila9g20 +++ b/sys/arm/at91/std.qila9g20 @@ -1,7 +1,6 @@ #$FreeBSD$ include "../at91/std.at91sam9" -options STARTUP_PAGETABLE_ADDR=0x20800000 makeoptions KERNPHYSADDR=0x20000000 makeoptions KERNVIRTADDR=0xc0000000 options KERNPHYSADDR=0x20000000 diff --git a/sys/arm/at91/std.sam9260ek b/sys/arm/at91/std.sam9260ek index e7d1884..fd4a7da 100644 --- a/sys/arm/at91/std.sam9260ek +++ b/sys/arm/at91/std.sam9260ek @@ -1,7 +1,6 @@ # $FreeBSD$ include "../at91/std.at91sam9" -options STARTUP_PAGETABLE_ADDR=0x20800000 makeoptions KERNPHYSADDR=0x20000000 makeoptions KERNVIRTADDR=0xc0000000 options KERNPHYSADDR=0x20000000 diff --git a/sys/arm/at91/std.sam9g20ek b/sys/arm/at91/std.sam9g20ek index cdbecda..160a893 100644 --- a/sys/arm/at91/std.sam9g20ek +++ b/sys/arm/at91/std.sam9g20ek @@ -1,7 +1,6 @@ #$FreeBSD$ include "../at91/std.at91sam9" -options STARTUP_PAGETABLE_ADDR=0x20800000 makeoptions KERNPHYSADDR=0x20000000 makeoptions KERNVIRTADDR=0xc0000000 options KERNPHYSADDR=0x20000000 diff --git a/sys/arm/at91/std.sam9x25ek b/sys/arm/at91/std.sam9x25ek index 661213b..4536b51 100644 --- a/sys/arm/at91/std.sam9x25ek +++ b/sys/arm/at91/std.sam9x25ek @@ -1,7 +1,6 @@ #$FreeBSD$ include "../at91/std.at91sam9" -options STARTUP_PAGETABLE_ADDR=0x20800000 makeoptions KERNPHYSADDR=0x20000000 makeoptions KERNVIRTADDR=0xc0000000 options KERNPHYSADDR=0x20000000 diff --git a/sys/arm/at91/std.sn9g45 b/sys/arm/at91/std.sn9g45 index e0d7c98..5376955 100644 --- a/sys/arm/at91/std.sn9g45 +++ b/sys/arm/at91/std.sn9g45 @@ -1,7 +1,6 @@ #$FreeBSD$ include "../at91/std.at91sam9g45" -options STARTUP_PAGETABLE_ADDR=0x70800000 makeoptions KERNPHYSADDR=0x70008000 options KERNPHYSADDR=0x70008000 makeoptions KERNVIRTADDR=0xc0008000 diff --git a/sys/arm/at91/std.tsc4370 b/sys/arm/at91/std.tsc4370 index 6c08f8c..6eb25cb 100644 --- a/sys/arm/at91/std.tsc4370 +++ b/sys/arm/at91/std.tsc4370 @@ -1,7 +1,6 @@ #$FreeBSD$ include "../at91/std.at91" -options STARTUP_PAGETABLE_ADDR=0x20800000 makeoptions KERNPHYSADDR=0x20000000 makeoptions KERNVIRTADDR=0xc0000000 options KERNPHYSADDR=0x20000000 diff --git a/sys/arm/at91/uart_dev_at91usart.c b/sys/arm/at91/uart_dev_at91usart.c index d16f239..69e3fb9 100644 --- a/sys/arm/at91/uart_dev_at91usart.c +++ b/sys/arm/at91/uart_dev_at91usart.c @@ -288,6 +288,10 @@ volatile uint32_t *at91_dbgu = (volatile uint32_t *)(AT91_BASE + AT91_DBGU0); void eputc(int c) { + + if (c == '\n') + eputc('\r'); + while (!(at91_dbgu[USART_CSR / 4] & USART_CSR_TXRDY)) continue; at91_dbgu[USART_THR / 4] = c; @@ -417,7 +421,6 @@ at91_usart_bus_attach(struct uart_softc *sc) { int err; int i; - uint32_t cr; struct at91_usart_softc *atsc; atsc = (struct at91_usart_softc *)sc; @@ -486,8 +489,8 @@ at91_usart_bus_attach(struct uart_softc *sc) } /* Turn on rx and tx */ - cr = USART_CR_RSTSTA | USART_CR_RSTRX | USART_CR_RSTTX; - WR4(&sc->sc_bas, USART_CR, cr); + DELAY(1000); /* Give pending character a chance to drain. */ + WR4(&sc->sc_bas, USART_CR, USART_CR_RSTSTA | USART_CR_RSTRX | USART_CR_RSTTX); WR4(&sc->sc_bas, USART_CR, USART_CR_RXEN | USART_CR_TXEN); /* diff --git a/sys/arm/broadcom/bcm2835/std.rpi b/sys/arm/broadcom/bcm2835/std.rpi index 8bb62c8..af99deb 100644 --- a/sys/arm/broadcom/bcm2835/std.rpi +++ b/sys/arm/broadcom/bcm2835/std.rpi @@ -7,6 +7,5 @@ makeoptions KERNVIRTADDR=0xc0100000 options KERNPHYSADDR=0x00100000 makeoptions KERNPHYSADDR=0x00100000 options PHYSADDR=0x00000000 -options STARTUP_PAGETABLE_ADDR=0x01000000 options FREEBSD_BOOT_LOADER options LINUX_BOOT_ABI diff --git a/sys/arm/conf/ATMEL b/sys/arm/conf/ATMEL index 74871eb..93d124d 100644 --- a/sys/arm/conf/ATMEL +++ b/sys/arm/conf/ATMEL @@ -10,7 +10,6 @@ include "../at91/std.atmel" # Typical values for most SoCs and board configurations. Will not work for # at91sam9g45 or on some boards with non u-boot boot loaders. -options STARTUP_PAGETABLE_ADDR=0x20800000 makeoptions KERNPHYSADDR=0x20000000 makeoptions KERNVIRTADDR=0xc0000000 options KERNPHYSADDR=0x20000000 diff --git a/sys/arm/conf/CNS11XXNAS b/sys/arm/conf/CNS11XXNAS index cab0682..159bbdf 100644 --- a/sys/arm/conf/CNS11XXNAS +++ b/sys/arm/conf/CNS11XXNAS @@ -25,7 +25,6 @@ ident CNS11XXNAS #options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm #options FLASHADDR=0x50000000 #options LOADERRAMADDR=0x00000000 -#options STARTUP_PAGETABLE_ADDR=0x10000000 include "../econa/std.econa" diff --git a/sys/arm/conf/CRB b/sys/arm/conf/CRB index d9b0a4e..850121e 100644 --- a/sys/arm/conf/CRB +++ b/sys/arm/conf/CRB @@ -24,7 +24,6 @@ options KERNPHYSADDR=0x00200000 options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm options COUNTS_PER_SEC=400000000 -options STARTUP_PAGETABLE_ADDR=0x00000000 include "../xscale/i8134x/std.crb" makeoptions MODULES_OVERRIDE="" diff --git a/sys/arm/conf/EP80219 b/sys/arm/conf/EP80219 index a112fe1..8d2c5bf 100644 --- a/sys/arm/conf/EP80219 +++ b/sys/arm/conf/EP80219 @@ -23,7 +23,6 @@ options PHYSADDR=0xa0000000 options KERNPHYSADDR=0xa0200000 options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm -options STARTUP_PAGETABLE_ADDR=0xa0000000 #options ARM32_NEW_VM_LAYOUT include "../xscale/i80321/std.ep80219" makeoptions MODULES_OVERRIDE="" diff --git a/sys/arm/conf/GUMSTIX b/sys/arm/conf/GUMSTIX index 11fe6a9..8b9824c 100644 --- a/sys/arm/conf/GUMSTIX +++ b/sys/arm/conf/GUMSTIX @@ -30,7 +30,6 @@ options PHYSADDR=0xa0000000 options KERNPHYSADDR=0xa0200000 options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm -options STARTUP_PAGETABLE_ADDR=0xa0000000 include "../xscale/pxa/std.pxa" makeoptions MODULES_OVERRIDE="" diff --git a/sys/arm/conf/IQ31244 b/sys/arm/conf/IQ31244 index 1eb4a20..c1cbc13 100644 --- a/sys/arm/conf/IQ31244 +++ b/sys/arm/conf/IQ31244 @@ -25,7 +25,6 @@ options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm options FLASHADDR=0xf0000000 options LOADERRAMADDR=0x00000000 -options STARTUP_PAGETABLE_ADDR=0xa0000000 include "../xscale/i80321/std.iq31244" makeoptions MODULES_OVERRIDE="" diff --git a/sys/arm/conf/NSLU b/sys/arm/conf/NSLU index e9b4e28..0b23ee2 100644 --- a/sys/arm/conf/NSLU +++ b/sys/arm/conf/NSLU @@ -25,7 +25,6 @@ ident NSLU #options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm #options FLASHADDR=0x50000000 #options LOADERRAMADDR=0x00000000 -#options STARTUP_PAGETABLE_ADDR=0x10000000 include "../xscale/ixp425/std.ixp425" # NB: memory mapping is defined in std.avila (see also comment above) diff --git a/sys/arm/conf/VERSATILEPB b/sys/arm/conf/VERSATILEPB index 78d0789..6f884d1 100644 --- a/sys/arm/conf/VERSATILEPB +++ b/sys/arm/conf/VERSATILEPB @@ -29,7 +29,6 @@ makeoptions KERNVIRTADDR=0xc0100000 options KERNPHYSADDR=0x00100000 makeoptions KERNPHYSADDR=0x00100000 options PHYSADDR=0x00000000 -options STARTUP_PAGETABLE_ADDR=0x01000000 options FREEBSD_BOOT_LOADER options LINUX_BOOT_ABI diff --git a/sys/arm/econa/std.econa b/sys/arm/econa/std.econa index 324caf3..6b1f2d0 100644 --- a/sys/arm/econa/std.econa +++ b/sys/arm/econa/std.econa @@ -12,6 +12,5 @@ options KERNPHYSADDR=0x01000000 options KERNVIRTADDR=0xc1000000 # Used in ldscript.arm options FLASHADDR=0xD0000000 options LOADERRAMADDR=0x00000000 -options STARTUP_PAGETABLE_ADDR=0x00100000 options NO_EVENTTIMERS diff --git a/sys/arm/freescale/imx/std.imx51 b/sys/arm/freescale/imx/std.imx51 index 6c70ef9..a6b6ffa 100644 --- a/sys/arm/freescale/imx/std.imx51 +++ b/sys/arm/freescale/imx/std.imx51 @@ -9,7 +9,6 @@ makeoptions KERNVIRTADDR=0xc0100000 options KERNPHYSADDR=0x90100000 makeoptions KERNPHYSADDR=0x90100000 options PHYSADDR=0x90000000 -options STARTUP_PAGETABLE_ADDR=0x91000000 files "../freescale/imx/files.imx51" diff --git a/sys/arm/freescale/imx/std.imx53 b/sys/arm/freescale/imx/std.imx53 index a7bdba2..40fbb30 100644 --- a/sys/arm/freescale/imx/std.imx53 +++ b/sys/arm/freescale/imx/std.imx53 @@ -9,7 +9,6 @@ makeoptions KERNVIRTADDR=0xc0100000 options KERNPHYSADDR=0x70100000 makeoptions KERNPHYSADDR=0x70100000 options PHYSADDR=0x70000000 -options STARTUP_PAGETABLE_ADDR=0x71000000 files "../freescale/imx/files.imx53" diff --git a/sys/arm/freescale/imx/std.imx6 b/sys/arm/freescale/imx/std.imx6 index abe09e9..c328b22 100644 --- a/sys/arm/freescale/imx/std.imx6 +++ b/sys/arm/freescale/imx/std.imx6 @@ -9,7 +9,6 @@ makeoptions KERNVIRTADDR = 0xc2000000 options KERNPHYSADDR = 0x12000000 makeoptions KERNPHYSADDR = 0x12000000 options PHYSADDR = 0x10000000 -options STARTUP_PAGETABLE_ADDR = 0x11f00000 files "../freescale/imx/files.imx6" diff --git a/sys/arm/freescale/vybrid/std.vybrid b/sys/arm/freescale/vybrid/std.vybrid index 92d5a46..2fbd85c 100644 --- a/sys/arm/freescale/vybrid/std.vybrid +++ b/sys/arm/freescale/vybrid/std.vybrid @@ -13,8 +13,6 @@ options KERNPHYSADDR=0x80100000 makeoptions KERNVIRTADDR=0xc0100000 options KERNVIRTADDR=0xc0100000 -options STARTUP_PAGETABLE_ADDR=0x81000000 - options ARM_L2_PIPT files "../freescale/vybrid/files.vybrid" diff --git a/sys/arm/lpc/std.lpc b/sys/arm/lpc/std.lpc index 84995ce..4c0d0d6 100644 --- a/sys/arm/lpc/std.lpc +++ b/sys/arm/lpc/std.lpc @@ -8,7 +8,6 @@ cpu CPU_ARM9 machine arm makeoptions CONF_CFLAGS="-march=armv5te" options PHYSADDR=0x80000000 -options STARTUP_PAGETABLE_ADDR=0x80000000 makeoptions KERNPHYSADDR=0x80100000 options KERNPHYSADDR=0x80100000 makeoptions KERNVIRTADDR=0xc0100000 diff --git a/sys/arm/mv/armadaxp/std.armadaxp b/sys/arm/mv/armadaxp/std.armadaxp index d731ad3..d53a803 100644 --- a/sys/arm/mv/armadaxp/std.armadaxp +++ b/sys/arm/mv/armadaxp/std.armadaxp @@ -12,6 +12,5 @@ makeoptions KERNVIRTADDR=0xc0200000 options KERNPHYSADDR=0x00200000 options KERNVIRTADDR=0xc0200000 options PHYSADDR=0x00000000 -options STARTUP_PAGETABLE_ADDR=0x00100000 options ARM_L2_PIPT diff --git a/sys/arm/mv/discovery/std.db78xxx b/sys/arm/mv/discovery/std.db78xxx index 7a7d927..70314fd 100644 --- a/sys/arm/mv/discovery/std.db78xxx +++ b/sys/arm/mv/discovery/std.db78xxx @@ -9,4 +9,3 @@ makeoptions KERNVIRTADDR=0xc0900000 options KERNPHYSADDR=0x00900000 options KERNVIRTADDR=0xc0900000 options PHYSADDR=0x00000000 -options STARTUP_PAGETABLE_ADDR=0x00100000 diff --git a/sys/arm/mv/kirkwood/std.kirkwood b/sys/arm/mv/kirkwood/std.kirkwood index 6b74920..abe2ddd 100644 --- a/sys/arm/mv/kirkwood/std.kirkwood +++ b/sys/arm/mv/kirkwood/std.kirkwood @@ -12,4 +12,3 @@ makeoptions KERNVIRTADDR=0xc0900000 options KERNPHYSADDR=0x00900000 options KERNVIRTADDR=0xc0900000 options PHYSADDR=0x00000000 -options STARTUP_PAGETABLE_ADDR=0x00100000 diff --git a/sys/arm/mv/orion/std.db88f5xxx b/sys/arm/mv/orion/std.db88f5xxx index 49c6ae4..7b52d7d 100644 --- a/sys/arm/mv/orion/std.db88f5xxx +++ b/sys/arm/mv/orion/std.db88f5xxx @@ -9,4 +9,3 @@ makeoptions KERNVIRTADDR=0xc0900000 options KERNPHYSADDR=0x00900000 options KERNVIRTADDR=0xc0900000 options PHYSADDR=0x00000000 -options STARTUP_PAGETABLE_ADDR=0x00100000 diff --git a/sys/arm/mv/orion/std.ts7800 b/sys/arm/mv/orion/std.ts7800 index 163af16..aa5dcef 100644 --- a/sys/arm/mv/orion/std.ts7800 +++ b/sys/arm/mv/orion/std.ts7800 @@ -9,7 +9,6 @@ makeoptions KERNVIRTADDR=0xc0900000 options KERNPHYSADDR=0x00900000 options KERNVIRTADDR=0xc0900000 options PHYSADDR=0x00000000 -options STARTUP_PAGETABLE_ADDR=0x00100000 options LOADERRAMADDR=0x00000000 options FLASHADDR=0x00008000 diff --git a/sys/arm/rockchip/std.rk30xx b/sys/arm/rockchip/std.rk30xx index 7b714bb..79ddcc6 100644 --- a/sys/arm/rockchip/std.rk30xx +++ b/sys/arm/rockchip/std.rk30xx @@ -17,8 +17,6 @@ options KERNPHYSADDR=0x60400000 makeoptions KERNVIRTADDR=0xc0400000 options KERNVIRTADDR=0xc0400000 -options STARTUP_PAGETABLE_ADDR=0x60200000 - options ARM_L2_PIPT options IPI_IRQ_START=0 diff --git a/sys/arm/s3c2xx0/std.ln2410sbc b/sys/arm/s3c2xx0/std.ln2410sbc index d73d62d..a76a849 100644 --- a/sys/arm/s3c2xx0/std.ln2410sbc +++ b/sys/arm/s3c2xx0/std.ln2410sbc @@ -6,6 +6,5 @@ makeoptions KERNVIRTADDR=0xc0000000 options KERNPHYSADDR=0x30000000 options KERNVIRTADDR=0xc0000000 options PHYSADDR=0x30000000 -options STARTUP_PAGETABLE_ADDR=0x30800000 options NO_EVENTTIMERS diff --git a/sys/arm/samsung/exynos/std.exynos5 b/sys/arm/samsung/exynos/std.exynos5 index 58f692c..5f59adc 100644 --- a/sys/arm/samsung/exynos/std.exynos5 +++ b/sys/arm/samsung/exynos/std.exynos5 @@ -13,8 +13,6 @@ options KERNPHYSADDR=0x40f00000 makeoptions KERNVIRTADDR=0xc0f00000 options KERNVIRTADDR=0xc0f00000 -options STARTUP_PAGETABLE_ADDR=0x40100000 - options ARM_L2_PIPT options IPI_IRQ_START=0 diff --git a/sys/arm/tegra/std.tegra2 b/sys/arm/tegra/std.tegra2 index 337b85f..e8d5524 100644 --- a/sys/arm/tegra/std.tegra2 +++ b/sys/arm/tegra/std.tegra2 @@ -11,6 +11,4 @@ options KERNPHYSADDR=0x00200000 makeoptions KERNVIRTADDR=0xc0200000 options KERNVIRTADDR=0xc0200000 -options STARTUP_PAGETABLE_ADDR=0x00100000 - files "../tegra/files.tegra2" diff --git a/sys/arm/ti/am335x/std.am335x b/sys/arm/ti/am335x/std.am335x index 1801cee..7bcc746 100644 --- a/sys/arm/ti/am335x/std.am335x +++ b/sys/arm/ti/am335x/std.am335x @@ -14,8 +14,6 @@ makeoptions KERNPHYSADDR=0x80200000 options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm makeoptions KERNVIRTADDR=0xc0200000 -options STARTUP_PAGETABLE_ADDR=0x80000000 - options SOC_TI_AM335X options ARM_L2_PIPT diff --git a/sys/arm/ti/omap4/std.omap4 b/sys/arm/ti/omap4/std.omap4 index bbdd432..27ec5ff 100644 --- a/sys/arm/ti/omap4/std.omap4 +++ b/sys/arm/ti/omap4/std.omap4 @@ -14,8 +14,6 @@ makeoptions KERNPHYSADDR=0x80200000 options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm makeoptions KERNVIRTADDR=0xc0200000 -options STARTUP_PAGETABLE_ADDR=0x80000000 - options SOC_OMAP4 options ARM_L2_PIPT diff --git a/sys/arm/ti/ti_mbox.c b/sys/arm/ti/ti_mbox.c index b7c9327..da00726 100644 --- a/sys/arm/ti/ti_mbox.c +++ b/sys/arm/ti/ti_mbox.c @@ -140,7 +140,7 @@ ti_mbox_attach(device_t dev) } sc = device_get_softc(dev); rid = 0; - mtx_init(&sc->sc_mtx, "TI mbox", MTX_DEF, 0); + mtx_init(&sc->sc_mtx, "TI mbox", NULL, MTX_DEF); sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->sc_mem_res == NULL) { diff --git a/sys/arm/ti/ti_pruss.c b/sys/arm/ti/ti_pruss.c index f70e8ef..8b9ab4b 100644 --- a/sys/arm/ti/ti_pruss.c +++ b/sys/arm/ti/ti_pruss.c @@ -166,7 +166,7 @@ ti_pruss_attach(device_t dev) } sc = device_get_softc(dev); rid = 0; - mtx_init(&sc->sc_mtx, "TI PRUSS", MTX_DEF, 0); + mtx_init(&sc->sc_mtx, "TI PRUSS", NULL, MTX_DEF); sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->sc_mem_res == NULL) { diff --git a/sys/arm/xilinx/std.zynq7 b/sys/arm/xilinx/std.zynq7 index 76a21e2..f387703 100644 --- a/sys/arm/xilinx/std.zynq7 +++ b/sys/arm/xilinx/std.zynq7 @@ -18,6 +18,5 @@ makeoptions KERNPHYSADDR=0x00100000 options KERNVIRTADDR=0xc0100000 # Used in ldscript.arm makeoptions KERNVIRTADDR=0xc0100000 -options STARTUP_PAGETABLE_ADDR=0x000f0000 options ARM_L2_PIPT diff --git a/sys/arm/xscale/ixp425/std.avila b/sys/arm/xscale/ixp425/std.avila index 77036ee..9c00e1b 100644 --- a/sys/arm/xscale/ixp425/std.avila +++ b/sys/arm/xscale/ixp425/std.avila @@ -19,4 +19,3 @@ options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm makeoptions KERNVIRTADDR=0xc0200000 options FLASHADDR=0x50000000 options LOADERRAMADDR=0x00000000 -options STARTUP_PAGETABLE_ADDR=0x00000000 diff --git a/sys/conf/ldscript.arm b/sys/conf/ldscript.arm index 0d1c7ee..353e365 100644 --- a/sys/conf/ldscript.arm +++ b/sys/conf/ldscript.arm @@ -107,6 +107,12 @@ SECTIONS *(.dynbss) *(.bss) *(COMMON) + . = ALIGN(32 / 8); + _ebss = .; + /* A section for the initial page table, it doesn't need to be in the + kernel file, however unlike normal .bss entries should not be zeroed + out as we use it before the .bss section is cleared. */ + *(.init_pagetable) } . = ALIGN(32 / 8); _end = . ; diff --git a/sys/conf/options.arm b/sys/conf/options.arm index 0296a1a..c7f0bcf 100644 --- a/sys/conf/options.arm +++ b/sys/conf/options.arm @@ -50,7 +50,6 @@ SOC_OMAP3 opt_global.h SOC_OMAP4 opt_global.h SOC_TI_AM335X opt_global.h SOC_TEGRA2 opt_global.h -STARTUP_PAGETABLE_ADDR opt_global.h XSCALE_CACHE_READ_WRITE_ALLOCATE opt_global.h XSACLE_DISABLE_CCNT opt_timer.h VERBOSE_INIT_ARM opt_global.h diff --git a/sys/dev/e1000/if_igb.c b/sys/dev/e1000/if_igb.c index 2134e296..d6e4de5 100644 --- a/sys/dev/e1000/if_igb.c +++ b/sys/dev/e1000/if_igb.c @@ -2381,7 +2381,9 @@ igb_allocate_legacy(struct adapter *adapter) { device_t dev = adapter->dev; struct igb_queue *que = adapter->queues; +#ifndef IGB_LEGACY_TX struct tx_ring *txr = adapter->tx_rings; +#endif int error, rid = 0; /* Turn off all interrupts */ diff --git a/sys/dev/hwpmc/hwpmc_powerpc.c b/sys/dev/hwpmc/hwpmc_powerpc.c index ed1f023..8da54c2 100644 --- a/sys/dev/hwpmc/hwpmc_powerpc.c +++ b/sys/dev/hwpmc/hwpmc_powerpc.c @@ -147,6 +147,7 @@ pmc_md_initialize() case MPC7455: case MPC7457: error = pmc_mpc7xxx_initialize(pmc_mdep); + break; case IBM970: case IBM970FX: case IBM970MP: diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c index cd3e3cf..5715df3 100644 --- a/sys/dev/pccbb/pccbb.c +++ b/sys/dev/pccbb/pccbb.c @@ -1038,6 +1038,13 @@ cbb_cardbus_power_disable_socket(device_t brdev, device_t child) /* CardBus Resource */ /************************************************************************/ +static void +cbb_activate_window(device_t brdev, int type) +{ + + PCI_ENABLE_IO(device_get_parent(brdev), brdev, type); +} + static int cbb_cardbus_io_open(device_t brdev, int win, uint32_t start, uint32_t end) { @@ -1055,6 +1062,7 @@ cbb_cardbus_io_open(device_t brdev, int win, uint32_t start, uint32_t end) pci_write_config(brdev, basereg, start, 4); pci_write_config(brdev, limitreg, end, 4); + cbb_activate_window(brdev, SYS_RES_IOPORT); return (0); } @@ -1075,6 +1083,7 @@ cbb_cardbus_mem_open(device_t brdev, int win, uint32_t start, uint32_t end) pci_write_config(brdev, basereg, start, 4); pci_write_config(brdev, limitreg, end, 4); + cbb_activate_window(brdev, SYS_RES_MEMORY); return (0); } @@ -1342,7 +1351,12 @@ cbb_pcic_activate_resource(device_t brdev, device_t child, int type, int rid, struct resource *res) { struct cbb_softc *sc = device_get_softc(brdev); - return (exca_activate_resource(&sc->exca[0], child, type, rid, res)); + int error; + + error = exca_activate_resource(&sc->exca[0], child, type, rid, res); + if (error == 0) + cbb_activate_window(brdev, type); + return (error); } static int diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c index 6bc1468..3f3de51 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -197,7 +197,6 @@ struct ukbd_softc { #define UKBD_FLAG_NUMLOCK 0x00080000 #define UKBD_FLAG_CAPSLOCK 0x00100000 #define UKBD_FLAG_SCROLLLOCK 0x00200000 -#define UKBD_FLAG_VALID_KEYS 0x00400000 int sc_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */ int sc_state; /* shift/lock key state */ @@ -474,7 +473,8 @@ ukbd_get_key(struct ukbd_softc *sc, uint8_t wait) || (sc->sc_flags & UKBD_FLAG_POLLING) != 0, ("not polling in kdb or panic\n")); - if (sc->sc_inputs == 0) { + if (sc->sc_inputs == 0 && + (sc->sc_flags & UKBD_FLAG_GONE) == 0) { /* start transfer, if not already started */ usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT]); } @@ -513,41 +513,6 @@ ukbd_interrupt(struct ukbd_softc *sc) n_mod = sc->sc_ndata.modifiers; o_mod = sc->sc_odata.modifiers; - - /* - * Don't output any modifier keys before we see a valid - * non-modifier key press. This prevents so-called "ghost - * keyboards" keeping modifier keys pressed while not actually - * seen as a real keyboard. - */ - if (sc->sc_flags & UKBD_FLAG_VALID_KEYS) - goto kfound; - - for (i = 0; i != UKBD_NKEYCODE; i++) { - key = sc->sc_ndata.keycode[i]; - switch (key) { - case 0xe0: - case 0xe4: - case 0xe1: - case 0xe5: - case 0xe2: - case 0xe6: - case 0xe3: - case 0xe7: - case 0x00: - case KEY_ERROR: - break; - default: - sc->sc_flags |= UKBD_FLAG_VALID_KEYS; - goto kfound; - } - } - DPRINTF("Keeping modifiers buffered\n"); - - /* keep modifiers in buffer */ - sc->sc_ndata.modifiers = n_mod = 0; - -kfound: if (n_mod != o_mod) { for (i = 0; i < UKBD_NMOD; i++) { if ((n_mod & ukbd_mods[i].mask) != @@ -1355,6 +1320,18 @@ ukbd_detach(device_t dev) usb_callout_stop(&sc->sc_callout); + /* kill any stuck keys */ + if (sc->sc_flags & UKBD_FLAG_ATTACHED) { + /* stop receiving events from the USB keyboard */ + usbd_transfer_stop(sc->sc_xfer[UKBD_INTR_DT]); + + /* release all leftover keys, if any */ + memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata)); + + /* process releasing of all keys */ + ukbd_interrupt(sc); + } + ukbd_disable(&sc->sc_kbd); #ifdef KBD_INSTALL_CDEV diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 66fdd5c..e9a4d7d 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -147,6 +147,7 @@ static int vtnet_txq_mq_start_locked(struct vtnet_txq *, struct mbuf *); static int vtnet_txq_mq_start(struct ifnet *, struct mbuf *); static void vtnet_txq_tq_deferred(void *, int); #endif +static void vtnet_txq_start(struct vtnet_txq *); static void vtnet_txq_tq_intr(void *, int); static void vtnet_txq_eof(struct vtnet_txq *); static void vtnet_tx_vq_intr(void *); @@ -843,7 +844,7 @@ vtnet_alloc_virtqueues(struct vtnet_softc *sc) if (sc->vtnet_flags & VTNET_FLAG_CTRL_VQ) nvqs++; - info = malloc(sizeof(struct vq_alloc_info) * nvqs , M_TEMP, M_NOWAIT); + info = malloc(sizeof(struct vq_alloc_info) * nvqs, M_TEMP, M_NOWAIT); if (info == NULL) return (ENOMEM); @@ -1820,9 +1821,9 @@ vtnet_rx_vq_intr(void *xrxq) return; } -again: VTNET_RXQ_LOCK(rxq); +again: if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { VTNET_RXQ_UNLOCK(rxq); return; @@ -1836,10 +1837,11 @@ again: * This is an occasional condition or race (when !more), * so retry a few times before scheduling the taskqueue. */ - rxq->vtnrx_stats.vrxs_rescheduled++; - VTNET_RXQ_UNLOCK(rxq); if (tries++ < VTNET_INTR_DISABLE_RETRIES) goto again; + + VTNET_RXQ_UNLOCK(rxq); + rxq->vtnrx_stats.vrxs_rescheduled++; taskqueue_enqueue(rxq->vtnrx_tq, &rxq->vtnrx_intrtask); } else VTNET_RXQ_UNLOCK(rxq); @@ -2241,6 +2243,12 @@ vtnet_txq_mq_start_locked(struct vtnet_txq *txq, struct mbuf *m) vtnet_txq_eof(txq); while ((m = drbr_peek(ifp, br)) != NULL) { + if (virtqueue_full(vq)) { + drbr_putback(ifp, br, m); + error = ENOBUFS; + break; + } + error = vtnet_txq_encap(txq, &m); if (error) { if (m != NULL) @@ -2309,6 +2317,24 @@ vtnet_txq_tq_deferred(void *xtxq, int pending) #endif /* VTNET_LEGACY_TX */ static void +vtnet_txq_start(struct vtnet_txq *txq) +{ + struct vtnet_softc *sc; + struct ifnet *ifp; + + sc = txq->vtntx_sc; + ifp = sc->vtnet_ifp; + +#ifdef VTNET_LEGACY_TX + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + vtnet_start_locked(txq, ifp); +#else + if (!drbr_empty(ifp, txq->vtntx_br)) + vtnet_txq_mq_start_locked(txq, NULL); +#endif +} + +static void vtnet_txq_tq_intr(void *xtxq, int pending) { struct vtnet_softc *sc; @@ -2328,13 +2354,7 @@ vtnet_txq_tq_intr(void *xtxq, int pending) vtnet_txq_eof(txq); -#ifdef VTNET_LEGACY_TX - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - vtnet_start_locked(txq, ifp); -#else - if (!drbr_empty(ifp, txq->vtntx_br)) - vtnet_txq_mq_start_locked(txq, NULL); -#endif + vtnet_txq_start(txq); if (vtnet_txq_enable_intr(txq) != 0) { vtnet_txq_disable_intr(txq); @@ -2395,9 +2415,9 @@ vtnet_tx_vq_intr(void *xtxq) return; } -again: VTNET_TXQ_LOCK(txq); +again: if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { VTNET_TXQ_UNLOCK(txq); return; @@ -2405,13 +2425,7 @@ again: vtnet_txq_eof(txq); -#ifdef VTNET_LEGACY_TX - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - vtnet_start_locked(txq, ifp); -#else - if (!drbr_empty(ifp, txq->vtntx_br)) - vtnet_txq_mq_start_locked(txq, NULL); -#endif + vtnet_txq_start(txq); if (vtnet_txq_enable_intr(txq) != 0) { vtnet_txq_disable_intr(txq); @@ -2419,9 +2433,10 @@ again: * This is an occasional race, so retry a few times * before scheduling the taskqueue. */ - VTNET_TXQ_UNLOCK(txq); if (tries++ < VTNET_INTR_DISABLE_RETRIES) goto again; + + VTNET_TXQ_UNLOCK(txq); txq->vtntx_stats.vtxs_rescheduled++; taskqueue_enqueue(txq->vtntx_tq, &txq->vtntx_intrtask); } else @@ -2431,24 +2446,16 @@ again: static void vtnet_tx_start_all(struct vtnet_softc *sc) { - struct ifnet *ifp; struct vtnet_txq *txq; int i; - ifp = sc->vtnet_ifp; VTNET_CORE_LOCK_ASSERT(sc); for (i = 0; i < sc->vtnet_act_vq_pairs; i++) { txq = &sc->vtnet_txqs[i]; VTNET_TXQ_LOCK(txq); -#ifdef VTNET_LEGACY_TX - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - vtnet_start_locked(txq, ifp); -#else - if (!drbr_empty(ifp, txq->vtntx_br)) - vtnet_txq_mq_start_locked(txq, NULL); -#endif + vtnet_txq_start(txq); VTNET_TXQ_UNLOCK(txq); } } diff --git a/sys/fs/ext2fs/ext2_bmap.c b/sys/fs/ext2fs/ext2_bmap.c index ca679c5..1ae3c2d 100644 --- a/sys/fs/ext2fs/ext2_bmap.c +++ b/sys/fs/ext2fs/ext2_bmap.c @@ -74,7 +74,7 @@ ext2_bmap(struct vop_bmap_args *ap) if (ap->a_bnp == NULL) return (0); - if (VTOI(ap->a_vp)->i_flags & E4_EXTENTS) + if (VTOI(ap->a_vp)->i_flag & IN_E4EXTENTS) error = ext4_bmapext(ap->a_vp, ap->a_bn, &blkno, ap->a_runp, ap->a_runb); else diff --git a/sys/fs/ext2fs/ext2_htree.c b/sys/fs/ext2fs/ext2_htree.c index 5cfec52..34af8ae 100644 --- a/sys/fs/ext2fs/ext2_htree.c +++ b/sys/fs/ext2fs/ext2_htree.c @@ -90,7 +90,7 @@ int ext2_htree_has_idx(struct inode *ip) { if (EXT2_HAS_COMPAT_FEATURE(ip->i_e2fs, EXT2F_COMPAT_DIRHASHINDEX) && - ip->i_flags & E4_INDEX) + ip->i_flag & IN_E4INDEX) return (1); else return (0); @@ -654,7 +654,7 @@ ext2_htree_create_index(struct vnode *vp, struct componentname *cnp, ((char *)ep + ep->e2d_reclen); ep->e2d_reclen = buf1 + blksize - (char *)ep; - dp->i_flags |= E4_INDEX; + dp->i_flag |= IN_E4INDEX; /* * Initialize index root. diff --git a/sys/fs/ext2fs/ext2_inode_cnv.c b/sys/fs/ext2fs/ext2_inode_cnv.c index 2205e3b..31c9557 100644 --- a/sys/fs/ext2fs/ext2_inode_cnv.c +++ b/sys/fs/ext2fs/ext2_inode_cnv.c @@ -108,8 +108,8 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip) ip->i_flags |= (ei->e2di_flags & EXT2_APPEND) ? SF_APPEND : 0; ip->i_flags |= (ei->e2di_flags & EXT2_IMMUTABLE) ? SF_IMMUTABLE : 0; ip->i_flags |= (ei->e2di_flags & EXT2_NODUMP) ? UF_NODUMP : 0; - ip->i_flags |= (ei->e2di_flags & EXT4_INDEX) ? E4_INDEX : 0; - ip->i_flags |= (ei->e2di_flags & EXT4_EXTENTS) ? E4_EXTENTS : 0; + ip->i_flag |= (ei->e2di_flags & EXT4_INDEX) ? IN_E4INDEX : 0; + ip->i_flag |= (ei->e2di_flags & EXT4_EXTENTS) ? IN_E4EXTENTS : 0; ip->i_blocks = ei->e2di_nblock; if (E2DI_HAS_HUGE_FILE(ip)) { ip->i_blocks |= (uint64_t)ei->e2di_nblock_high << 32; @@ -158,6 +158,8 @@ ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei) ei->e2di_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND: 0; ei->e2di_flags |= (ip->i_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE: 0; ei->e2di_flags |= (ip->i_flags & UF_NODUMP) ? EXT2_NODUMP: 0; + ei->e2di_flags |= (ip->i_flag & IN_E4INDEX) ? EXT4_INDEX: 0; + ei->e2di_flags |= (ip->i_flag & IN_E4EXTENTS) ? EXT4_EXTENTS: 0; ei->e2di_nblock = ip->i_blocks & 0xffffffff; ei->e2di_nblock_high = ip->i_blocks >> 32 & 0xffff; ei->e2di_gen = ip->i_gen; diff --git a/sys/fs/ext2fs/ext2_lookup.c b/sys/fs/ext2fs/ext2_lookup.c index 1fd7da0..c674197 100644 --- a/sys/fs/ext2fs/ext2_lookup.c +++ b/sys/fs/ext2fs/ext2_lookup.c @@ -887,7 +887,7 @@ ext2_direnter(struct inode *ip, struct vnode *dvp, struct componentname *cnp) if (ext2_htree_has_idx(dp)) { error = ext2_htree_add_entry(dvp, &newdir, cnp); if (error) { - dp->i_flags &= ~E4_INDEX; + dp->i_flag &= ~IN_E4INDEX; dp->i_flag |= IN_CHANGE | IN_UPDATE; } return (error); diff --git a/sys/fs/ext2fs/ext2_subr.c b/sys/fs/ext2fs/ext2_subr.c index 585a975..6b9041d 100644 --- a/sys/fs/ext2fs/ext2_subr.c +++ b/sys/fs/ext2fs/ext2_subr.c @@ -82,10 +82,10 @@ ext2_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp) *bpp = NULL; /* - * E4_EXTENTS requires special treatment as we can otherwise fall + * IN_E4EXTENTS requires special treatment as we can otherwise fall * back to the normal path. */ - if (!(ip->i_flags & E4_EXTENTS)) + if (!(ip->i_flag & IN_E4EXTENTS)) goto normal; memset(&path, 0, sizeof(path)); @@ -110,7 +110,7 @@ ext2_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp) if (res) *res = (char *)bp->b_data + blkoff(fs, offset); /* - * If E4_EXTENTS is enabled we would get a wrong offset so + * If IN_E4EXTENTS is enabled we would get a wrong offset so * reset b_offset here. */ bp->b_offset = lbn * bsize; diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c index 3ad5786..a18d5cc1 100644 --- a/sys/fs/ext2fs/ext2_vfsops.c +++ b/sys/fs/ext2fs/ext2_vfsops.c @@ -964,10 +964,10 @@ ext2_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp) * blocks are zeroed out - ext2_balloc depends on this * although for regular files and directories only * - * If E4_EXTENTS is enabled, unused blocks are not zeroed + * If IN_E4EXTENTS is enabled, unused blocks are not zeroed * out because we could corrupt the extent tree. */ - if (!(ip->i_flags & E4_EXTENTS) && + if (!(ip->i_flag & IN_E4EXTENTS) && (S_ISDIR(ip->i_mode) || S_ISREG(ip->i_mode))) { used_blocks = (ip->i_size+fs->e2fs_bsize-1) / fs->e2fs_bsize; for (i = used_blocks; i < EXT2_NDIR_BLOCKS; i++) diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c index 1ab1fdd..4bcedc2 100644 --- a/sys/fs/ext2fs/ext2_vnops.c +++ b/sys/fs/ext2fs/ext2_vnops.c @@ -343,8 +343,7 @@ ext2_getattr(struct vop_getattr_args *ap) vap->va_birthtime.tv_sec = ip->i_birthtime; vap->va_birthtime.tv_nsec = ip->i_birthnsec; } - /* E4_* flags are private to the filesystem. */ - vap->va_flags = ip->i_flags & ~(E4_INDEX | E4_EXTENTS); + vap->va_flags = ip->i_flags; vap->va_gen = ip->i_gen; vap->va_blocksize = vp->v_mount->mnt_stat.f_iosize; vap->va_bytes = dbtob((u_quad_t)ip->i_blocks); @@ -1616,7 +1615,7 @@ ext2_read(struct vop_read_args *ap) ip = VTOI(vp); /*EXT4_EXT_LOCK(ip);*/ - if (ip->i_flags & E4_EXTENTS) + if (ip->i_flag & IN_E4EXTENTS) error = ext4_ext_read(ap); else error = ext2_ind_read(ap); diff --git a/sys/fs/ext2fs/inode.h b/sys/fs/ext2fs/inode.h index af244ad..21c7944 100644 --- a/sys/fs/ext2fs/inode.h +++ b/sys/fs/ext2fs/inode.h @@ -157,8 +157,8 @@ struct inode { * These are translation flags for some attributes that Ext4 * passes as inode flags but that we cannot pass directly. */ -#define E4_INDEX 0x01000000 -#define E4_EXTENTS 0x02000000 +#define IN_E4INDEX 0x010000 +#define IN_E4EXTENTS 0x020000 #define i_devvp i_ump->um_devvp diff --git a/sys/kern/capabilities.conf b/sys/kern/capabilities.conf index 8d33472..f7a46ae 100644 --- a/sys/kern/capabilities.conf +++ b/sys/kern/capabilities.conf @@ -667,6 +667,7 @@ sigsuspend sigtimedwait sigvec sigwaitinfo +sigwait ## ## Allow creating new socket pairs with socket(2) and socketpair(2). diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index 6c94f3d..0f99f60 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -463,7 +463,7 @@ struct sysent sysent[] = { { AS(__acl_set_link_args), (sy_call_t *)sys___acl_set_link, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 426 = __acl_set_link */ { AS(__acl_delete_link_args), (sy_call_t *)sys___acl_delete_link, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 427 = __acl_delete_link */ { AS(__acl_aclcheck_link_args), (sy_call_t *)sys___acl_aclcheck_link, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 428 = __acl_aclcheck_link */ - { AS(sigwait_args), (sy_call_t *)sys_sigwait, AUE_SIGWAIT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 429 = sigwait */ + { AS(sigwait_args), (sy_call_t *)sys_sigwait, AUE_SIGWAIT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 429 = sigwait */ { AS(thr_create_args), (sy_call_t *)sys_thr_create, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 430 = thr_create */ { AS(thr_exit_args), (sy_call_t *)sys_thr_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 431 = thr_exit */ { AS(thr_self_args), (sy_call_t *)sys_thr_self, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 432 = thr_self */ diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c index 94908ac..ca07788 100644 --- a/sys/kern/subr_lock.c +++ b/sys/kern/subr_lock.c @@ -78,7 +78,7 @@ lock_init(struct lock_object *lock, struct lock_class *class, const char *name, int i; /* Check for double-init and zero object. */ - KASSERT(!lock_initalized(lock), ("lock \"%s\" %p already initialized", + KASSERT(!lock_initialized(lock), ("lock \"%s\" %p already initialized", name, lock)); /* Look up lock class to find its index. */ @@ -100,7 +100,7 @@ void lock_destroy(struct lock_object *lock) { - KASSERT(lock_initalized(lock), ("lock %p is not initialized", lock)); + KASSERT(lock_initialized(lock), ("lock %p is not initialized", lock)); WITNESS_DESTROY(lock); LOCK_LOG_DESTROY(lock, 0); lock->lo_flags &= ~LO_INITIALIZED; diff --git a/sys/sys/lock.h b/sys/sys/lock.h index 4ff0e79..e4b573a 100644 --- a/sys/sys/lock.h +++ b/sys/sys/lock.h @@ -178,7 +178,7 @@ struct lock_class { #define LOCK_LOG_DESTROY(lo, flags) LOCK_LOG_INIT(lo, flags) -#define lock_initalized(lo) ((lo)->lo_flags & LO_INITIALIZED) +#define lock_initialized(lo) ((lo)->lo_flags & LO_INITIALIZED) /* * Helpful macros for quickly coming up with assertions with informative diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h index 39d8f45..3d5f08c 100644 --- a/sys/sys/mutex.h +++ b/sys/sys/mutex.h @@ -382,7 +382,7 @@ extern struct mtx_pool *mtxpool_sleep; _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), \ tick_sbt * (timo), 0, C_HARDCLOCK) -#define mtx_initialized(m) lock_initalized(&(m)->lock_object) +#define mtx_initialized(m) lock_initialized(&(m)->lock_object) #define mtx_owned(m) (((m)->mtx_lock & ~MTX_FLAGMASK) == (uintptr_t)curthread) diff --git a/sys/sys/rwlock.h b/sys/sys/rwlock.h index a327340..6be6949 100644 --- a/sys/sys/rwlock.h +++ b/sys/sys/rwlock.h @@ -218,7 +218,7 @@ void __rw_assert(const volatile uintptr_t *c, int what, const char *file, _sleep((chan), &(rw)->lock_object, (pri), (wmesg), \ tick_sbt * (timo), 0, C_HARDCLOCK) -#define rw_initialized(rw) lock_initalized(&(rw)->lock_object) +#define rw_initialized(rw) lock_initialized(&(rw)->lock_object) struct rw_args { void *ra_rw; |