Compare commits

...

16 Commits

Author SHA1 Message Date
Alexander Ziaee
7f7f1bb7ec
Merge f29ea08fd3 into 2cb7605a24 2024-06-26 09:31:34 -03:00
Zhenlei Huang
2cb7605a24 lo: Use new KPI to create the first loop interface
While here remove a pointless static local variable lo_cloner.

No functional change intended.

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45728
2024-06-26 18:00:37 +08:00
Doug Moore
8502c68d29 x86_iommu: use roundup_pow_of_two
Drop a private implementation of roundup_pow_of_two and use the global
one instead.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45739
2024-06-26 04:23:54 -05:00
Andrew Turner
5afc347944 arm: Start to remove the now unneeded acle-compat.h
All supported compilers provide the acle macros so we don't need the
backup versions.

Keep the file around for anything that included it directly, but make
it an error to not support the acle macros.

Reviewed by:	imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45726
2024-06-26 08:52:08 +00:00
Doug Moore
7d37fcbf52 cxgbe: replace a loop with rounddown_pow_of_two
Replace a loop with a function call.

Reviewed by:	np, alc
Differential Revision:	https://reviews.freebsd.org/D45716
2024-06-26 03:19:16 -05:00
Konstantin Belousov
7e5574f9e5 sched_unpin(): assert that curthread was pinned
Reviewed by:	emaste, imp, markj, olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D45736
2024-06-26 10:04:10 +03:00
Warner Losh
b2351a4ba5 test: disable sys.kern.unix_seqpacket_test.random_eor_and_waitall
It's been failing for a while, at least some of the time.

PR: 279994
Sponsored by:		Netflix
2024-06-25 19:35:13 -06:00
Kyle Evans
3da568710f stand: module: unlink the entire tail when dependencies fail to load
Assume you have loader configured to load linux64, which has a
dependency on both linux_common and mqueuefs but neither the kernel
nor kernel config in question have the mqueuefs module included.

When the load command for linux64 fails to find mqueuefs, it will
free both linux64 and linux_common as they were loaded first, but only
linux64 gets removed from the module list.  As a result, future
traversals hit an easy use-after-free with linux_common.

Fix it so that we unlink the entire tail of the list.  Anything after
the initially loaded module is, by definition, a dependency on the
loaded module while we're still in the load command, so we can just
discard the entire tail.  If linux_common were loaded before linux64, it
should not move to a position during this load where it would suddenly
be missing from the view presented to the kernel.

Reported by:	philip
Reviewed by:	imp, philip, tsoome
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D45731
2024-06-25 15:32:08 -05:00
Mark Johnston
7d6932d20a ctladm: Fix a race when loading ctl.ko
If multiple ctladm processes try to load ctl.ko at the same time, only
one will succeed.  Handle this possibility by retrying the operation
(open /dev/cam/ctl) if kldload returns EEXIST, rather than bailing.
This at least helps ensure that ctladm tests can be run in parallel
when ctl.ko is not preloaded.

Reviewed by:	asomers
MFC after:	1 week
2024-06-25 15:29:03 -04:00
Ryan Libby
f29bdea047 ext4_ext_tree_init: correct memset initialization
gcc -Wmemset-elt-size diagnosed this.  The code was only initializing
1/4 of the array.  However, it was actually harmless, as the only caller
had done an M_ZERO allocation anyway.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D45701
2024-06-25 10:41:11 -07:00
Ryan Libby
07cc7ea738 libmsun: remove duplicates after cdefs.h added inline to __always_inline
Reviewed by:	kib, olce
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45712
2024-06-25 10:40:14 -07:00
Ryan Libby
d25f0bdceb cdefs.h: add __inline to __always_inline
Add __inline to the __always_inline macro to quiet dozens of gcc
warnings of the form:
warning: 'always_inline' function might not be inlinable [-Wattributes]

It's clearly the intention of the __always_inline macro applied to a
function to inline the function.  However, gcc seems to be picky with
the -Wattributes.  It appears that __attribute__((__always_inline__))
was intended to apply to inline functions, as in, function declarations
with the attribute should also be declared as inline.  Both clang and
gcc sources themselves use the two in combination:
inline __attribute__((__always_inline__))

FreeBSD sources mostly only use __always_inline, without the inline
keyword.  Only a few files in libmsun used both.

Reviewed by:	imp, kib, olce
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D45711
2024-06-25 10:39:13 -07:00
Mariusz Zaborski
8aa9192ce9 isp: fix ISPCTL_ABORT_CMD switch case
Prevent kernel panic by not running ISPCTL_FCLINK_TEST after a
failed ISPCTL_ABORT_CMD.

Reviewed by:	mav
Tested by:	Arne Steinkamm <arne@steinkamm.com>
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D45718
2024-06-25 16:56:12 +02:00
Ruslan Bukin
44d4ee7f3d riscv: add FPE code.
Add floating point extension (FPE) code needed for bhyve and world switch.

Reviewed by:	mhorne
Sponsored by:	UKRI
Differential Revision:	https://reviews.freebsd.org/D45697
2024-06-25 12:35:35 +01:00
Ruslan Bukin
d5963606f0 riscv: add SBI implementation IDs.
Add new SBI implementation IDs including recently allocated one for bhyve.

Reviewed by:	mhorne
Sponsored by:	UKRI
Differential Revision:	https://reviews.freebsd.org/D45696
2024-06-25 12:25:26 +01:00
Alexander Ziaee
f29ea08fd3
man.sh: revert trapping SIGPIPE
Closes:		279542
Fixes:		14a5c1068d
Reported by:	emaste
2024-06-10 00:21:37 -04:00
22 changed files with 277 additions and 199 deletions

View File

@ -54,7 +54,7 @@ pio2_2t = 2.0670321098263988236496903051604844e-43L, /* 0x127044533e63a0105df5
pio2_3 = 2.0670321098263988236499468110329591e-43L, /* 0x127044533e63a0105e00000000000.0p-254 */
pio2_3t = -2.5650587247459238361625433492959285e-65L; /* -0x159c4ec64ddaeb5f78671cbfb2210.0p-327 */
static inline __always_inline int
static __always_inline int
__ieee754_rem_pio2l(long double x, long double *y)
{
union IEEEl2bits u,u1;

View File

@ -444,7 +444,7 @@ struct ld {
#endif
#ifdef STRUCT_RETURN
static inline __always_inline void
static __always_inline void
k_logl(long double x, struct ld *rp)
#else
long double

View File

@ -66,7 +66,7 @@ pio2_2t = 6.36831716351095013979e-25L, /* 0xc51701b839a25205.0p-144 */
pio2_3t = -2.75299651904407171810e-37L; /* -0xbb5bf6c7ddd660ce.0p-185 */
#endif
static inline __always_inline int
static __always_inline int
__ieee754_rem_pio2l(long double x, long double *y)
{
union IEEEl2bits u,u1;

View File

@ -444,7 +444,7 @@ struct ld {
#endif
#ifdef STRUCT_RETURN
static inline __always_inline void
static __always_inline void
k_logl(long double x, struct ld *rp)
#else
long double

View File

@ -45,7 +45,7 @@ pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */
pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
#ifdef INLINE_REM_PIO2
static __inline __always_inline
static __always_inline
#endif
int
__ieee754_rem_pio2(double x, double *y)

View File

@ -38,7 +38,7 @@ pio2_1 = 1.57079631090164184570e+00, /* 0x3FF921FB, 0x50000000 */
pio2_1t = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */
#ifdef INLINE_REM_PIO2F
static __inline __always_inline
static __always_inline
#endif
int
__ieee754_rem_pio2f(float x, double *y)

View File

@ -64,6 +64,7 @@ static char *mod_searchmodule(char *name, struct mod_depend *verinfo);
static char * mod_searchmodule_pnpinfo(const char *bus, const char *pnpinfo);
static void file_insert_tail(struct preloaded_file *mp);
static void file_remove(struct preloaded_file *fp);
static void file_remove_tail(struct preloaded_file *fp);
struct file_metadata* metadata_next(struct file_metadata *base_mp, int type);
static void moduledir_readhints(struct moduledir *mdp);
static void moduledir_rebuild(void);
@ -876,7 +877,7 @@ mod_loadkld(const char *kldname, int argc, char *argv[])
file_insert_tail(fp); /* Add to the list of loaded files */
if (file_load_dependencies(fp) != 0) {
err = ENOENT;
file_remove(fp);
file_remove_tail(fp);
loadaddr = loadaddr_saved;
fp = NULL;
break;
@ -1637,25 +1638,45 @@ file_insert_tail(struct preloaded_file *fp)
* Remove module from the chain
*/
static void
file_remove(struct preloaded_file *fp)
file_remove_impl(struct preloaded_file *fp, bool keep_tail)
{
struct preloaded_file *cm;
struct preloaded_file *cm, *next;
if (preloaded_files == NULL)
return;
if (keep_tail)
next = fp->f_next;
else
next = NULL;
if (preloaded_files == fp) {
preloaded_files = fp->f_next;
preloaded_files = next;
return;
}
for (cm = preloaded_files; cm->f_next != NULL; cm = cm->f_next) {
if (cm->f_next == fp) {
cm->f_next = fp->f_next;
cm->f_next = next;
return;
}
}
}
static void
file_remove(struct preloaded_file *fp)
{
file_remove_impl(fp, true);
}
static void
file_remove_tail(struct preloaded_file *fp)
{
file_remove_impl(fp, false);
}
static char *
moduledir_fullpath(struct moduledir *mdp, const char *fname)
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 ARM Ltd
* Copyright (c) 2024 Arm Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -27,157 +27,5 @@
*/
#ifndef __ARM_ARCH
/* ACLE standardises a set of pre-defines that describe the ARM architecture.
These were mostly implemented in GCC around GCC-4.8; older versions
have no, or only partial support. To provide a level of backwards
compatibility we try to work out what the definitions should be, given
the older pre-defines that GCC did produce. This isn't complete, but
it should be enough for use by routines that depend on this header. */
/* No need to handle ARMv8, GCC had ACLE support before that. */
#define __ARM_ACLE 101
# ifdef __ARM_ARCH_7__
/* The common subset of ARMv7 in all profiles. */
# define __ARM_ARCH 7
# define __ARM_ARCH_ISA_THUMB 2
# define __ARM_FEATURE_CLZ
# define __ARM_FEATURE_LDREX 7
# define __ARM_FEATURE_UNALIGNED
# endif
# if defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7R__)
# define __ARM_ARCH 7
# define __ARM_ARCH_ISA_THUMB 2
# define __ARM_ARCH_ISA_ARM
# define __ARM_FEATURE_CLZ
# define __ARM_FEATURE_SIMD32
# define __ARM_FEATURE_DSP
# define __ARM_FEATURE_QBIT
# define __ARM_FEATURE_SAT
# define __ARM_FEATURE_LDREX 15
# define __ARM_FEATURE_UNALIGNED
# ifdef __ARM_ARCH_7A__
# define __ARM_ARCH_PROFILE 'A'
# else
# define __ARM_ARCH_PROFILE 'R'
# endif
# endif
# ifdef __ARM_ARCH_7EM__
# define __ARM_ARCH 7
# define __ARM_ARCH_ISA_THUMB 2
# define __ARM_FEATURE_CLZ
# define __ARM_FEATURE_SIMD32
# define __ARM_FEATURE_DSP
# define __ARM_FEATURE_QBIT
# define __ARM_FEATURE_SAT
# define __ARM_FEATURE_LDREX 7
# define __ARM_FEATURE_UNALIGNED
# define __ARM_ARCH_PROFILE 'M'
# endif
# ifdef __ARM_ARCH_7M__
# define __ARM_ARCH 7
# define __ARM_ARCH_ISA_THUMB 2
# define __ARM_FEATURE_CLZ
# define __ARM_FEATURE_QBIT
# define __ARM_FEATURE_SAT
# define __ARM_FEATURE_LDREX 7
# define __ARM_FEATURE_UNALIGNED
# define __ARM_ARCH_PROFILE 'M'
# endif
# ifdef __ARM_ARCH_6T2__
# define __ARM_ARCH 6
# define __ARM_ARCH_ISA_THUMB 2
# define __ARM_ARCH_ISA_ARM
# define __ARM_FEATURE_CLZ
# define __ARM_FEATURE_SIMD32
# define __ARM_FEATURE_DSP
# define __ARM_FEATURE_QBIT
# define __ARM_FEATURE_SAT
# define __ARM_FEATURE_LDREX 4
# define __ARM_FEATURE_UNALIGNED
# endif
# ifdef __ARM_ARCH_6M__
# define __ARM_ARCH 6
# define __ARM_ARCH_ISA_THUMB 1
# define __ARM_ARCH_PROFILE 'M'
# endif
# if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) \
|| defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6Z__) \
|| defined (__ARM_ARCH_6ZK__)
# define __ARM_ARCH 6
# define __ARM_ARCH_ISA_THUMB 1
# define __ARM_ARCH_ISA_ARM
# define __ARM_FEATURE_CLZ
# define __ARM_FEATURE_SIMD32
# define __ARM_FEATURE_DSP
# define __ARM_FEATURE_QBIT
# define __ARM_FEATURE_SAT
# define __ARM_FEATURE_UNALIGNED
# ifndef __thumb__
# if defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__)
# define __ARM_FEATURE_LDREX 15
# else
# define __ARM_FEATURE_LDREX 4
# endif
# endif
# endif
# if defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5E__)
# define __ARM_ARCH 5
# define __ARM_ARCH_ISA_ARM
# ifdef __ARM_ARCH_5TE__
# define __ARM_ARCH_ISA_THUMB 1
# endif
# define __ARM_FEATURE_CLZ
# define __ARM_FEATURE_DSP
# endif
# if defined (__ARM_ARCH_5T__) || defined (__ARM_ARCH_5__)
# define __ARM_ARCH 5
# define __ARM_ARCH_ISA_ARM
# ifdef __ARM_ARCH_5TE__
# define __ARM_ARCH_ISA_THUMB 1
# endif
# define __ARM_FEATURE_CLZ
# endif
# ifdef __ARM_ARCH_4T__
# define __ARM_ARCH 4
# define __ARM_ARCH_ISA_ARM
# define __ARM_ARCH_ISA_THUMB 1
# endif
# ifdef __ARM_ARCH_4__
# define __ARM_ARCH 4
# define __ARM_ARCH_ISA_ARM
# endif
# if defined (__ARM_ARCH_3__) || defined (__ARM_ARCH_3M__)
# define __ARM_ARCH 3
# define __ARM_ARCH_ISA_ARM
# endif
# ifdef __ARM_ARCH_2__
# define __ARM_ARCH 2
# define __ARM_ARCH_ISA_ARM
# endif
# ifdef __ARMEB__
# define __ARM_BIG_ENDIAN
# endif
/* If we still don't know what the target architecture is, then we're
probably not using GCC. */
# ifndef __ARM_ARCH
# error Unable to determine architecture version.
# endif
#endif /* __ARM_ARCH */
#error Your compiler is too old
#endif

View File

@ -4349,9 +4349,7 @@ calculate_iaq(struct adapter *sc, struct intrs_and_queues *iaq, int itype,
*/
do {
if (iaq->nrxq > 1) {
do {
iaq->nrxq--;
} while (!powerof2(iaq->nrxq));
iaq->nrxq = rounddown_pow_of_two(iaq->nrxq - 1);
if (iaq->nnmrxq > iaq->nrxq)
iaq->nnmrxq = iaq->nrxq;
}

View File

@ -3099,6 +3099,7 @@ isp_control(ispsoftc_t *isp, ispctl_t ctl, ...)
if (ab->abrt_nphdl == ISP24XX_ABRT_OKAY)
return (0);
isp_prt(isp, ISP_LOGWARN, "Chan %d handle %d abort returned 0x%x", chan, tgt, ab->abrt_nphdl);
break;
}
case ISPCTL_FCLINK_TEST:
{

View File

@ -711,7 +711,7 @@ ext4_ext_tree_init(struct inode *ip)
ip->i_flag |= IN_E4EXTENTS;
memset(ip->i_data, 0, EXT2_NDADDR + EXT2_NIADDR);
memset(ip->i_data, 0, sizeof(ip->i_data));
ehp = (struct ext4_extent_header *)ip->i_data;
ehp->eh_magic = htole16(EXT4_EXT_MAGIC);
ehp->eh_max = htole16(ext4_ext_space_root(ip));

View File

@ -93,13 +93,9 @@ static int looutput(struct ifnet *ifp, struct mbuf *m,
const struct sockaddr *dst, struct route *ro);
VNET_DEFINE(struct ifnet *, loif); /* Used externally */
#ifdef VIMAGE
VNET_DEFINE_STATIC(struct if_clone *, lo_cloner);
#define V_lo_cloner VNET(lo_cloner)
#endif
static struct if_clone *lo_cloner;
static const char loname[] = "lo";
static int
@ -141,8 +137,6 @@ lo_clone_create(struct if_clone *ifc, char *name, size_t len,
ifp->if_hwassist = LO_CSUM_FEATURES | LO_CSUM_FEATURES6;
if_attach(ifp);
bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
if (V_loif == NULL)
V_loif = ifp;
*ifpp = ifp;
return (0);
@ -156,12 +150,9 @@ vnet_loif_init(const void *unused __unused)
.destroy_f = lo_clone_destroy,
.flags = IFC_F_AUTOUNIT,
};
lo_cloner = ifc_attach_cloner(loname, &req);
#ifdef VIMAGE
V_lo_cloner = lo_cloner;
#endif
V_lo_cloner = ifc_attach_cloner(loname, &req);
struct ifc_data ifd = { .unit = 0 };
ifc_create_ifp(loname, &ifd, NULL);
ifc_create_ifp(loname, &ifd, &V_loif);
}
VNET_SYSINIT(vnet_loif_init, SI_SUB_PSEUDO, SI_ORDER_ANY,
vnet_loif_init, NULL);

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2016 Ruslan Bukin <br@bsdpad.com>
* Copyright (c) 2016-2024 Ruslan Bukin <br@bsdpad.com>
* All rights reserved.
*
* This software was developed by SRI International and the University of
@ -34,4 +34,14 @@
void fpe_state_save(struct thread *td);
void fpe_state_clear(void);
struct fpreg *fpu_save_area_alloc(void);
void fpu_save_area_free(struct fpreg *fsa);
void fpu_save_area_reset(struct fpreg *fsa);
void fpe_enable(void);
void fpe_disable(void);
void fpe_store(struct fpreg *state);
void fpe_restore(struct fpreg *state);
#endif /* !_MACHINE_FPE_H_ */

View File

@ -49,6 +49,12 @@
#define SBI_IMPL_ID_KVM 3
#define SBI_IMPL_ID_RUSTSBI 4
#define SBI_IMPL_ID_DIOSIX 5
#define SBI_IMPL_ID_COFFER 6
#define SBI_IMPL_ID_XEN_PROJECT 7
#define SBI_IMPL_ID_POLARFIRE_HSS 8
#define SBI_IMPL_ID_COREBOOT 9
#define SBI_IMPL_ID_OREBOOT 10
#define SBI_IMPL_ID_BHYVE 11
/* SBI Error Codes */
#define SBI_SUCCESS 0

190
sys/riscv/riscv/fpe.c Normal file
View File

@ -0,0 +1,190 @@
/*-
* Copyright (c) 2024 Ruslan Bukin <br@bsdpad.com>
*
* This software was developed by the University of Cambridge Computer
* Laboratory (Department of Computer Science and Technology) under Innovate
* UK project 105694, "Digital Security by Design (DSbD) Technology Platform
* Prototype".
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <vm/uma.h>
#include <machine/fpe.h>
#include <machine/reg.h>
static uma_zone_t fpu_save_area_zone;
static struct fpreg *fpu_initialstate;
void
fpe_enable(void)
{
uint64_t reg;
reg = SSTATUS_FS_INITIAL;
csr_set(sstatus, reg);
}
void
fpe_disable(void)
{
uint64_t mask;
mask = SSTATUS_FS_MASK;
csr_clear(sstatus, mask);
}
void
fpe_store(struct fpreg *regs)
{
uint64_t fcsr, (*fp_x)[32][2];
fp_x = &regs->fp_x;
__asm __volatile(
"frcsr %0 \n"
"fsd f0, (16 * 0)(%1)\n"
"fsd f1, (16 * 1)(%1)\n"
"fsd f2, (16 * 2)(%1)\n"
"fsd f3, (16 * 3)(%1)\n"
"fsd f4, (16 * 4)(%1)\n"
"fsd f5, (16 * 5)(%1)\n"
"fsd f6, (16 * 6)(%1)\n"
"fsd f7, (16 * 7)(%1)\n"
"fsd f8, (16 * 8)(%1)\n"
"fsd f9, (16 * 9)(%1)\n"
"fsd f10, (16 * 10)(%1)\n"
"fsd f11, (16 * 11)(%1)\n"
"fsd f12, (16 * 12)(%1)\n"
"fsd f13, (16 * 13)(%1)\n"
"fsd f14, (16 * 14)(%1)\n"
"fsd f15, (16 * 15)(%1)\n"
"fsd f16, (16 * 16)(%1)\n"
"fsd f17, (16 * 17)(%1)\n"
"fsd f18, (16 * 18)(%1)\n"
"fsd f19, (16 * 19)(%1)\n"
"fsd f20, (16 * 20)(%1)\n"
"fsd f21, (16 * 21)(%1)\n"
"fsd f22, (16 * 22)(%1)\n"
"fsd f23, (16 * 23)(%1)\n"
"fsd f24, (16 * 24)(%1)\n"
"fsd f25, (16 * 25)(%1)\n"
"fsd f26, (16 * 26)(%1)\n"
"fsd f27, (16 * 27)(%1)\n"
"fsd f28, (16 * 28)(%1)\n"
"fsd f29, (16 * 29)(%1)\n"
"fsd f30, (16 * 30)(%1)\n"
"fsd f31, (16 * 31)(%1)\n"
: "=&r"(fcsr), "=r"(fp_x), "=m"(*fp_x));
regs->fp_fcsr = fcsr;
}
void
fpe_restore(struct fpreg *regs)
{
uint64_t fcsr, (*fp_x)[32][2];
fp_x = &regs->fp_x;
fcsr = regs->fp_fcsr;
__asm __volatile(
"fscsr %0 \n"
"fld f0, (16 * 0)(%1)\n"
"fld f1, (16 * 1)(%1)\n"
"fld f2, (16 * 2)(%1)\n"
"fld f3, (16 * 3)(%1)\n"
"fld f4, (16 * 4)(%1)\n"
"fld f5, (16 * 5)(%1)\n"
"fld f6, (16 * 6)(%1)\n"
"fld f7, (16 * 7)(%1)\n"
"fld f8, (16 * 8)(%1)\n"
"fld f9, (16 * 9)(%1)\n"
"fld f10, (16 * 10)(%1)\n"
"fld f11, (16 * 11)(%1)\n"
"fld f12, (16 * 12)(%1)\n"
"fld f13, (16 * 13)(%1)\n"
"fld f14, (16 * 14)(%1)\n"
"fld f15, (16 * 15)(%1)\n"
"fld f16, (16 * 16)(%1)\n"
"fld f17, (16 * 17)(%1)\n"
"fld f18, (16 * 18)(%1)\n"
"fld f19, (16 * 19)(%1)\n"
"fld f20, (16 * 20)(%1)\n"
"fld f21, (16 * 21)(%1)\n"
"fld f22, (16 * 22)(%1)\n"
"fld f23, (16 * 23)(%1)\n"
"fld f24, (16 * 24)(%1)\n"
"fld f25, (16 * 25)(%1)\n"
"fld f26, (16 * 26)(%1)\n"
"fld f27, (16 * 27)(%1)\n"
"fld f28, (16 * 28)(%1)\n"
"fld f29, (16 * 29)(%1)\n"
"fld f30, (16 * 30)(%1)\n"
"fld f31, (16 * 31)(%1)\n"
:: "r"(fcsr), "r"(fp_x), "m"(*fp_x));
}
struct fpreg *
fpu_save_area_alloc(void)
{
return (uma_zalloc(fpu_save_area_zone, M_WAITOK));
}
void
fpu_save_area_free(struct fpreg *fsa)
{
uma_zfree(fpu_save_area_zone, fsa);
}
void
fpu_save_area_reset(struct fpreg *fsa)
{
memcpy(fsa, fpu_initialstate, sizeof(*fsa));
}
static void
fpe_init(const void *dummy __unused)
{
fpu_save_area_zone = uma_zcreate("FPE save area", sizeof(struct fpreg),
NULL, NULL, NULL, NULL, _Alignof(struct fpreg) - 1, 0);
fpu_initialstate = uma_zalloc(fpu_save_area_zone, M_WAITOK | M_ZERO);
fpe_enable();
fpe_store(fpu_initialstate);
fpe_disable();
bzero(fpu_initialstate->fp_x, sizeof(fpu_initialstate->fp_x));
}
SYSINIT(fpe, SI_SUB_CPU, SI_ORDER_ANY, fpe_init, NULL);

View File

@ -132,6 +132,11 @@ sbi_print_version(void)
case (SBI_IMPL_ID_BBL):
printf("SBI: Berkely Boot Loader %lu\n", sbi_impl_version);
break;
case (SBI_IMPL_ID_OPENSBI):
major = sbi_impl_version >> OPENSBI_VERSION_MAJOR_OFFSET;
minor = sbi_impl_version & OPENSBI_VERSION_MINOR_MASK;
printf("SBI: OpenSBI v%u.%u\n", major, minor);
break;
case (SBI_IMPL_ID_XVISOR):
printf("SBI: eXtensible Versatile hypervISOR %lu\n",
sbi_impl_version);
@ -146,10 +151,24 @@ sbi_print_version(void)
case (SBI_IMPL_ID_DIOSIX):
printf("SBI: Diosix %lu\n", sbi_impl_version);
break;
case (SBI_IMPL_ID_OPENSBI):
major = sbi_impl_version >> OPENSBI_VERSION_MAJOR_OFFSET;
minor = sbi_impl_version & OPENSBI_VERSION_MINOR_MASK;
printf("SBI: OpenSBI v%u.%u\n", major, minor);
case (SBI_IMPL_ID_COFFER):
printf("SBI: Coffer %lu\n", sbi_impl_version);
break;
case (SBI_IMPL_ID_XEN_PROJECT):
printf("SBI: Xen Project %lu\n", sbi_impl_version);
break;
case (SBI_IMPL_ID_POLARFIRE_HSS):
printf("SBI: PolarFire Hart Software Services %lu\n",
sbi_impl_version);
break;
case (SBI_IMPL_ID_COREBOOT):
printf("SBI: coreboot %lu\n", sbi_impl_version);
break;
case (SBI_IMPL_ID_OREBOOT):
printf("SBI: oreboot %lu\n", sbi_impl_version);
break;
case (SBI_IMPL_ID_BHYVE):
printf("SBI: bhyve %lu\n", sbi_impl_version);
break;
default:
printf("SBI: Unrecognized Implementation: %lu\n", sbi_impl_id);

View File

@ -265,7 +265,7 @@
#define __malloc_like __attribute__((__malloc__))
#define __pure __attribute__((__pure__))
#define __always_inline __attribute__((__always_inline__))
#define __always_inline __inline __attribute__((__always_inline__))
#define __noinline __attribute__ ((__noinline__))
#define __fastcall __attribute__((__fastcall__))
#define __result_use_check __attribute__((__warn_unused_result__))

View File

@ -180,6 +180,7 @@ static __inline void
sched_unpin(void)
{
atomic_interrupt_fence();
MPASS(curthread->td_pinned > 0);
curthread->td_pinned--;
}

View File

@ -315,13 +315,6 @@ dmar_ir_free_irte(struct dmar_unit *unit, u_int cookie)
return (0);
}
static u_int
clp2(u_int v)
{
return (powerof2(v) ? v : 1 << fls(v));
}
int
dmar_init_irt(struct dmar_unit *unit)
{
@ -339,7 +332,7 @@ dmar_init_irt(struct dmar_unit *unit)
"QI disabled, disabling interrupt remapping\n");
return (0);
}
unit->irte_cnt = clp2(num_io_irqs);
unit->irte_cnt = roundup_pow_of_two(num_io_irqs);
unit->irt = kmem_alloc_contig(unit->irte_cnt * sizeof(dmar_irte_t),
M_ZERO | M_WAITOK, 0, iommu_high, PAGE_SIZE, 0,
DMAR_IS_COHERENT(unit) ?

View File

@ -1197,6 +1197,9 @@ ATF_TC_BODY(random_eor_and_waitall, tc)
size_t off;
int fd[2], eor;
if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
atf_tc_skip("https://bugs.freebsd.org/279994");
arc4random_buf(params.seed, sizeof(params.seed));
printf("Using seed:");
for (u_int i = 0; i < (u_int)sizeof(params.seed)/sizeof(u_short); i++)

View File

@ -36,9 +36,6 @@ ulimit -t 20
# do not ignore the exit status of roff tools
set -o pipefail
# ignore SIGPIPE exits because pagers may exit before reading all their input.
trap '' SIGPIPE
# Usage: add_to_manpath path
# Adds a variable to manpath while ensuring we don't have duplicates.
# Returns true if we were able to add something. False otherwise.

View File

@ -4469,7 +4469,7 @@ main(int argc, char **argv)
if (fd == -1 && errno == ENOENT) {
saved_errno = errno;
retval = kldload("ctl");
if (retval != -1)
if (retval != -1 || errno == EEXIST)
fd = open(device, O_RDWR);
else
errno = saved_errno;