Home
last modified time | relevance | path

Searched full:alignment (Results 1 – 25 of 1526) sorted by relevance

12345678910>>...62

/linux/rust/kernel/
H A Dptr.rs16 /// Type representing an alignment, which is always a power of two.
18 /// It is used to validate that a given value is a valid alignment, and to perform masking and
19 /// alignment operations.
21 /// This is a temporary substitute for the [`Alignment`] nightly type from the standard library,
24 /// [`Alignment`]: https://github.com/rust-lang/rust/issues/102070
28 /// An alignment is always a power of two.
31 pub struct Alignment(NonZero<usize>); struct
33 impl Alignment { implementation
34 /// Validates that `ALIGN` is a power of two at build-time, and returns an [`Alignment`] of the
42 /// use kernel::ptr::Alignment;
[all...]
/linux/tools/testing/selftests/exec/
H A Dload_address.c13 unsigned long long alignment; member
28 stats->alignment = 0; in ExtractStatistics()
43 if (align > stats->alignment) in ExtractStatistics()
44 stats->alignment = align; in ExtractStatistics()
77 ksft_print_msg("load_address=%#llx alignment=%#llx\n", in main()
78 extracted.load_address, extracted.alignment); in main()
89 /* Did we find an alignment? */ in main()
90 ksft_test_result(extracted.alignment != 0, in main()
91 "Alignment%s found\n", extracted.alignment ? "" : " NOT"); in main()
93 /* Is the alignment sane? */ in main()
[all …]
/linux/arch/mips/include/asm/octeon/
H A Dcvmx-bootmem.h41 /* minimum alignment of bootmem alloced blocks */
158 * @alignment: Alignment required - must be power of 2
162 uint64_t alignment);
181 * @alignment: Alignment required - must be power of 2
186 extern void *cvmx_bootmem_alloc_named(uint64_t size, uint64_t alignment,
200 * @align: Alignment of memory to be allocated. (must be a power of 2)
221 * @param align Alignment of memory to be allocated. (must be a power of 2)
251 * (optional) requested address and alignment.
261 * @alignment: Requested alignment of the block. If this alignment
263 * power of 2. (Note: Alignment of
[all …]
/linux/drivers/gpu/drm/i915/
H A Di915_gem_gtt.c161 * @alignment: required alignment of starting offset, may be 0 but
172 * is can insert the node. The hole address is aligned to @alignment and
192 u64 size, u64 alignment, unsigned long color, in i915_gem_gtt_insert() argument
203 GEM_BUG_ON(alignment && !is_power_of_2(alignment)); in i915_gem_gtt_insert()
204 GEM_BUG_ON(alignment && !IS_ALIGNED(alignment, I915_GTT_MIN_ALIGNMENT)); in i915_gem_gtt_insert()
214 if (unlikely(round_up(start, alignment) > round_down(end - size, alignment))) in i915_gem_gtt_insert()
224 * so we know that we always have a minimum alignment of 4096. in i915_gem_gtt_insert()
226 * with zero alignment, so where possible use the optimal in i915_gem_gtt_insert()
230 if (alignment <= I915_GTT_MIN_ALIGNMENT) in i915_gem_gtt_insert()
231 alignment = 0; in i915_gem_gtt_insert()
[all …]
/linux/drivers/misc/
H A Dpci_endpoint_test.c150 size_t alignment; member
157 size_t alignment; member
676 struct pci_endpoint_test_xfer_param *param, size_t alignment) in pci_endpoint_test_validate_xfer_params() argument
683 if (param->size > SIZE_MAX - alignment) { in pci_endpoint_test_validate_xfer_params()
709 size_t alignment = test->alignment; in pci_endpoint_test_copy() local
721 ret = pci_endpoint_test_validate_xfer_params(dev, &param, alignment); in pci_endpoint_test_copy()
737 orig_src_addr = kzalloc(size + alignment, GFP_KERNEL); in pci_endpoint_test_copy()
743 get_random_bytes(orig_src_addr, size + alignment); in pci_endpoint_test_copy()
745 size + alignment, DMA_TO_DEVICE); in pci_endpoint_test_copy()
752 if (alignment && !IS_ALIGNED(orig_src_phys_addr, alignment)) { in pci_endpoint_test_copy()
[all …]
/linux/Documentation/ABI/testing/
H A Dsysfs-bus-iio-dma-buffer5 DMA buffers tend to have a alignment requirement for the
6 buffers. If this alignment requirement is not met samples might
9 This property reports the alignment requirements in bytes.
13 The alignment requirements in number of sample sets will depend
15 that the alignment requirement in samples sets might change
17 the alignment requirement reported in bytes by this property
/linux/arch/mips/cavium-octeon/executive/
H A Dcvmx-bootmem.c128 * @alignment: Alignment required - must be power of 2
131 static void *cvmx_bootmem_alloc_range(uint64_t size, uint64_t alignment, in cvmx_bootmem_alloc_range() argument
136 cvmx_bootmem_phy_alloc(size, min_addr, max_addr, alignment, 0); in cvmx_bootmem_alloc_range()
145 uint64_t alignment) in cvmx_bootmem_alloc_address() argument
147 return cvmx_bootmem_alloc_range(size, alignment, address, in cvmx_bootmem_alloc_address()
165 void *cvmx_bootmem_alloc_named(uint64_t size, uint64_t alignment, char *name) in cvmx_bootmem_alloc_named() argument
167 return cvmx_bootmem_alloc_named_range(size, 0, 0, alignment, name); in cvmx_bootmem_alloc_named()
218 uint64_t address_max, uint64_t alignment, in cvmx_bootmem_phy_alloc() argument
235 (unsigned long long)alignment); in cvmx_bootmem_phy_alloc()
259 /* Round req_size up to mult of minimum alignment bytes */ in cvmx_bootmem_phy_alloc()
[all …]
/linux/Documentation/arch/arm/
H A Dmem_alignment.rst2 Memory alignment
6 kernel code lately. Therefore the alignment fixup is now unconditionally
13 Of course this is a bad idea to rely on the alignment trap to perform
16 alignment trap can fixup misaligned access for the exception cases, but at
19 Now for user space applications, it is possible to configure the alignment
30 To change the alignment trap behavior, simply echo a number into
31 /proc/cpu/alignment. The number is made up from various bits:
56 echo 1 > /proc/cpu/alignment
/linux/arch/powerpc/lib/
H A Drheap.c253 rh_info_t *rh_create(unsigned int alignment) in rh_create() argument
257 /* Alignment must be a power of two */ in rh_create()
258 if ((alignment & (alignment - 1)) != 0) in rh_create()
265 info->alignment = alignment; in rh_create()
300 void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks, in rh_init() argument
306 /* Alignment must be a power of two */ in rh_init()
307 if ((alignment & (alignment - 1)) != 0) in rh_init()
310 info->alignment = alignment; in rh_init()
338 m = info->alignment - 1; in rh_attach_region()
383 m = info->alignment - 1; in rh_detach_region()
[all …]
/linux/arch/parisc/include/asm/
H A Dldcw.h5 /* Because kmalloc only guarantees 8-byte alignment for kmalloc'd data,
6 and GCC only guarantees 8-byte alignment for stack locals, we can't
7 be assured of 16-byte alignment for atomic lock data even if we
16 16-byte alignment requirement for ldcw and ldcd is relaxed, and instead
17 they only require "natural" alignment (4-byte for ldcw, 8-byte for
22 require 16-byte alignment. If the address is unaligned, the operation
25 This hid the problem for years. So, restore the 16-byte alignment dropped
/linux/rust/zerocopy/src/
H A Derror.rs36 //! For [`Unaligned`] destination types, alignment errors are impossible. All
37 //! compound error types support infallibly discarding the alignment error via
71 //! Our conversion methods typically check alignment, then size, then bit
143 /// [`FromBytes::ref_from_bytes`] may fail due to alignment or size issues, but
157 Alignment(A), enumerator
167 /// Infallibly discards the alignment error from this `ConvertError` since
170 /// Since [`Dst: Unaligned`], it is impossible to encounter an alignment
171 /// error. This method permits discarding that alignment error infallibly
194 /// // the alignment error.
202 ConvertError::Alignment(e) => { in from()
[all …]
H A Dlayout.rs101 Alignment, enumerator
106 /// The minimum possible alignment of a type.
112 /// The maximum theoretic possible alignment of a type.
123 /// The current, documented max alignment of a type \[1\].
125 /// \[1\] Per <https://doc.rust-lang.org/reference/type-layout.html#the-alignment-modifiers>:
127 /// The alignment value must be a power of two from 1 up to
163 /// If `self` describes the size and alignment of type that lacks static
165 /// accurately reflects the size, alignment, and lack of static shallow
172 /// alignment (or 1). If `repr_align` is provided, then it must be a power
243 // SAFETY: The alignment of a slice is equal to the alignment of its in for_slice()
[all …]
H A Dwrappers.rs16 /// A type with no alignment requirement.
18 /// An `Unalign` wraps a `T`, removing any alignment requirement. `Unalign<T>`
20 /// alignment [or ABI]. This is useful if a type with an alignment requirement
21 /// needs to be read from a chunk of memory which provides no alignment
24 /// Since `Unalign` has no alignment requirement, the inner `T` may not be
29 /// fail if the `Unalign` does not satisfy `T`'s alignment requirement at
33 /// the `Unalign` satisfies `T`'s alignment requirement
48 /// In this example, we need `EthernetFrame` to have no alignment requirement -
51 /// alignment requirement so that `EthernetFrame` has no alignment requirement
92 /// // alignment requirement.
[all …]
/linux/Documentation/core-api/
H A Dunaligned-memory-access.rst36 Natural alignment
39 The rule mentioned above forms what we refer to as natural alignment:
43 When writing code, assume the target architecture has natural alignment
46 In reality, only a few architectures require natural alignment on all sizes
48 writing code that satisfies natural alignment requirements is the easiest way
100 Fortunately, the compiler understands the alignment constraints, so in the
126 For a natural alignment scheme, the compiler would only have to add a single
128 to satisfy alignment constraints for arrays of these structures.
137 architectural alignment requirements. However, again, the compiler is aware
138 of the alignment constraints and will generate extra instructions to perform
[all …]
/linux/drivers/bluetooth/
H A Dhci_h4.c158 u8 alignment = hu->alignment ? hu->alignment : 1; in h4_recv_buf() local
255 hu->padding = (skb->len + 1) % alignment; in h4_recv_buf()
256 hu->padding = (alignment - hu->padding) % alignment; in h4_recv_buf()
263 hu->padding = (skb->len + 1) % alignment; in h4_recv_buf()
264 hu->padding = (alignment - hu->padding) % alignment; in h4_recv_buf()
/linux/rust/kernel/sync/atomic/
H A Dpredefine.rs7 // Ensure size and alignment requirements are checked.
11 // SAFETY: `bool` has the same size and alignment as `i8`, and Rust guarantees that `bool` has
18 // SAFETY: `i8` has the same size and alignment with itself, and is round-trip transmutable to in rhs_into_delta()
24 // SAFETY: `i16` has the same size and alignment with itself, and is round-trip transmutable to
32 // - `*mut T` has the same size and alignment with `*const c_void`, and is round-trip
42 // - `*const T` has the same size and alignment with `*const c_void`, and is round-trip
50 // SAFETY: `i32` has the same size and alignment with itself, and is round-trip transmutable to
63 // SAFETY: `i64` has the same size and alignment with itself, and is round-trip transmutable to
76 // Defines an internal type that always maps to the integer type which has the same size alignment
97 // Ensure size and alignment requirement in rhs_into_delta()
[all...]
/linux/drivers/firmware/efi/libstub/
H A Dloongarch-stub.c24 * @alignment: minimum alignment of the allocated memory area. It
29 * to @alignment but at least EFI_ALLOC_ALIGN. If the preferred address
43 unsigned long alignment, in efi_relocate_kernel() argument
65 * as possible while respecting the required alignment. in efi_relocate_kernel()
76 status = efi_low_alloc_above(alloc_size, alignment, &new_addr, in efi_relocate_kernel()
/linux/arch/xtensa/lib/
H A Dmemset.S30 * the alignment labels).
45 movi a6, 3 # for alignment tests
57 .align 4 # 1 mod 4 alignment for LOOPNEZ
58 .byte 0 # (0 mod 4 alignment for LBEG)
106 bbci.l a5, 0, .L20 # branch if dst alignment half-aligned
126 .byte 0 # 1 mod 4 alignment for LOOPNEZ
127 # (0 mod 4 alignment for LBEG)
/linux/arch/powerpc/include/asm/
H A Drheap.h27 unsigned int alignment; member
50 extern rh_info_t *rh_create(unsigned int alignment);
56 extern void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks,
65 /* Allocate the given size from the remote heap (with alignment) */
66 extern unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment,
/linux/rust/zerocopy/src/pointer/
H A Dinvariant.rs15 //! Invariants are encoded as ([`Aliasing`], [`Alignment`], [`Validity`])
21 type Alignment: Alignment; typedef
25 impl<A: Aliasing, AA: Alignment, V: Validity> Invariants for (A, AA, V) {
27 type Alignment = AA; typedef
43 /// The alignment invariant of a [`Ptr`][super::Ptr].
44 pub trait Alignment: Sealed { interface
50 I: Invariants<Alignment = Self, Validity = Valid>, in read() argument
145 impl Alignment for Unaligned {
150 I: Invariants<Alignment = Self, Validity = Valid>, in read() argument
158 /// of the `T`'s alignment.
[all …]
H A Dptr.rs48 /// - `ptr` conforms to the alignment invariant of
49 /// [`I::Alignment`](invariant::Alignment).
66 /// 1. `ptr` conforms to the alignment invariant of
67 /// [`I::Alignment`](invariant::Alignment).
88 /// 1. `ptr` conforms to the alignment invariant of
89 /// [`I::Alignment`](invariant::Alignment).
121 /// - Alignment is a property of the referent type (`T`) and the address,
183 // 1. `ptr`, by invariant on `&'a T`, conforms to the alignment in from_ref()
210 // 1. `ptr`, by invariant on `&'a mut T`, conforms to the alignment in from_mut()
227 I: Invariants<Alignment = Aligned, Validity = Valid>,
[all …]
/linux/drivers/mtd/ubi/
H A Dvmt.c34 __ATTR(alignment, S_IRUGO, vol_attribute_show, NULL);
85 ret = sprintf(buf, "%d\n", vol->alignment); in vol_attribute_show()
228 vol->usable_leb_size = ubi->leb_size - ubi->leb_size % req->alignment; in ubi_create_volume()
247 vol->alignment = req->alignment; in ubi_create_volume()
248 vol->data_pad = ubi->leb_size % vol->alignment; in ubi_create_volume()
307 vtbl_rec.alignment = cpu_to_be32(vol->alignment); in ubi_create_volume()
684 int reserved_pebs, alignment, data_pad, vol_type, name_len, upd_marker; in self_check_volume() local
702 if (vol->reserved_pebs < 0 || vol->alignment < 0 || vol->data_pad < 0 || in self_check_volume()
707 if (vol->alignment > ubi->leb_size || vol->alignment == 0) { in self_check_volume()
708 ubi_err(ubi, "bad alignment"); in self_check_volume()
[all …]
/linux/lib/
H A Dubsan.c74 * SanitizerKind::Alignment emits SanitizerHandler::TypeMismatch in report_ubsan_failure()
78 return "UBSAN: alignment assumption"; in report_ubsan_failure()
380 pr_err("which requires %ld byte alignment\n", data->alignment); in handle_misaligned_access()
406 else if (data->alignment && !IS_ALIGNED(ptr, data->alignment)) in ubsan_type_mismatch_common()
420 .alignment = data->alignment, in __ubsan_handle_type_mismatch()
434 .alignment = 1UL << data->log_alignment, in __ubsan_handle_type_mismatch_v1()
543 ubsan_prologue(&data->location, "alignment-assumption"); in __ubsan_handle_alignment_assumption()
546 pr_err("assumption of %lu byte alignment (with offset of %lu byte) for pointer of type %s failed", in __ubsan_handle_alignment_assumption()
549 pr_err("assumption of %lu byte alignment for pointer of type %s failed", in __ubsan_handle_alignment_assumption()
/linux/drivers/media/platform/mediatek/mdp/
H A Dmtk_mdp_core.h34 * struct mtk_mdp_pix_align - alignment of image
35 * @org_w: source alignment of width
36 * @org_h: source alignment of height
37 * @target_w: dst alignment of width
38 * @target_h: dst alignment of height
57 * @align: pointer to a pixel alignment struct, NULL if using default value
116 * @pix_align: alignment of image
/linux/arch/arm/mm/
H A Dalignment.c3 * linux/arch/arm/mm/alignment.c
7 * Thumb alignment fault fixups (c) 2004 MontaVista Software, Inc.
34 * /proc/sys/debug/alignment, modified and integrated into
88 core_param(alignment, ai_usermode, int, 0600);
107 * Ignoring the alignment fault is not an option on these in safe_usermode()
115 pr_warn("alignment: ignoring faults is unsafe on this CPU. Defaulting to fixup mode.\n"); in safe_usermode()
488 * LDM/STM alignment handler.
530 * For alignment faults on the ARM922T/ARM920T the MMU makes in do_alignment_ldmstm()
534 * [ls]dm alignment faults are noisy! in do_alignment_ldmstm()
588 pr_err("Alignment trap: not handling ldm with s-bit set\n"); in do_alignment_ldmstm()
[all …]

12345678910>>...62