# 1 "" # 1 "././include/linux/kconfig.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __LINUX_KCONFIG_H #define __LINUX_KCONFIG_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "././include/linux/kconfig.h" # 1 "./include/generated/autoconf.h" 1 /* * * Automatically generated file; DO NOT EDIT. * Linux/x86 4.15.0 Kernel Configuration * */ #define CONFIG_RING_BUFFER 1 #define CONFIG_HAVE_ARCH_SECCOMP_FILTER 1 #define CONFIG_SND_PROC_FS 1 #define CONFIG_SCSI_DMA 1 #define CONFIG_TCP_MD5SIG 1 #define CONFIG_KERNEL_GZIP 1 #define CONFIG_MICROCODE 1 #define CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK 1 #define CONFIG_INPUT_KEYBOARD 1 #define CONFIG_SLUB_CPU_PARTIAL 1 #define CONFIG_RFS_ACCEL 1 #define CONFIG_CRC32 1 #define CONFIG_I2C_BOARDINFO 1 #define CONFIG_HAVE_AOUT 1 #define CONFIG_IR_JVC_DECODER 1 #define CONFIG_X86_MCE 1 #define CONFIG_FB_TILEBLITTING 1 #define CONFIG_IR_MCE_KBD_DECODER 1 #define CONFIG_SECCOMP 1 #define CONFIG_HIGH_RES_TIMERS 1 #define CONFIG_ARCH_HAS_SET_MEMORY 1 #define CONFIG_BLK_DEV_DM 1 #define CONFIG_IP_MULTIPLE_TABLES 1 #define CONFIG_UEVENT_HELPER 1 #define CONFIG_FIRMWARE_MEMMAP 1 #define CONFIG_FIX_EARLYCON_MEM 1 #define CONFIG_XZ_DEC_IA64 1 #define CONFIG_INOTIFY_USER 1 #define CONFIG_HDMI 1 #define CONFIG_NETWORK_FILESYSTEMS 1 #define CONFIG_MODULE_FORCE_UNLOAD 1 #define CONFIG_X86_MINIMUM_CPU_FAMILY 5 #define CONFIG_CPU_FREQ_GOV_ONDEMAND 1 #define CONFIG_GLOB 1 #define CONFIG_PARAVIRT_SPINLOCKS 1 #define CONFIG_X86_TSC 1 #define CONFIG_ARCH_SUSPEND_POSSIBLE 1 #define CONFIG_INLINE_WRITE_UNLOCK_IRQ 1 #define CONFIG_RC_CORE 1 #define CONFIG_MAC80211_STA_HASH_MAX_SIZE 0 #define CONFIG_HAVE_ARCH_MMAP_RND_BITS 1 #define CONFIG_HIBERNATION 1 #define CONFIG_PNPACPI 1 #define CONFIG_CPU_FREQ_GOV_ATTR_SET 1 #define CONFIG_EXT4_FS_POSIX_ACL 1 #define CONFIG_DRM_I915 1 #define CONFIG_BINFMT_MISC 1 #define CONFIG_SSB_POSSIBLE 1 #define CONFIG_NF_NAT_SIP_MODULE 1 #define CONFIG_MMU_NOTIFIER 1 #define CONFIG_ASYMMETRIC_KEY_TYPE 1 #define CONFIG_IP_NF_NAT_MODULE 1 #define CONFIG_USB_OHCI_LITTLE_ENDIAN 1 #define CONFIG_NET_SCH_FIFO 1 #define CONFIG_FSNOTIFY 1 #define CONFIG_BLK_DEV_LOOP_MIN_COUNT 8 #define CONFIG_ARCH_FLATMEM_ENABLE 1 #define CONFIG_NF_CONNTRACK_SIP 1 #define CONFIG_CRYPTO_MANAGER_DISABLE_TESTS 1 #define CONFIG_HIDRAW 1 #define CONFIG_HAVE_KERNEL_LZMA 1 #define CONFIG_ARCH_WANT_IPC_PARSE_VERSION 1 #define CONFIG_NET_PTP_CLASSIFY 1 #define CONFIG_GENERIC_SMP_IDLE_THREAD 1 #define CONFIG_NET_VENDOR_QUALCOMM 1 #define CONFIG_HAVE_COPY_THREAD_TLS 1 #define CONFIG_HAVE_MEMORY_PRESENT 1 #define CONFIG_NET_VENDOR_EZCHIP 1 #define CONFIG_SERIAL_8250_RSA 1 #define CONFIG_FIB_RULES 1 #define CONFIG_IP6_NF_MANGLE 1 #define CONFIG_SCSI_CONSTANTS 1 #define CONFIG_HAVE_IRQ_TIME_ACCOUNTING 1 #define CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED 1 #define CONFIG_IPV6 1 #define CONFIG_CRYPTO_AEAD 1 #define CONFIG_MAGIC_SYSRQ_SERIAL 1 #define CONFIG_BQL 1 #define CONFIG_HAVE_KERNEL_BZIP2 1 #define CONFIG_DEFAULT_TCP_CONG "cubic" #define CONFIG_UEVENT_HELPER_PATH "/sbin/hotplug" #define CONFIG_DEVTMPFS 1 #define CONFIG_TIGON3_HWMON 1 #define CONFIG_HSU_DMA 1 #define CONFIG_YENTA_RICOH 1 #define CONFIG_MOUSE_PS2_SMBUS 1 #define CONFIG_IP6_NF_TARGET_REJECT 1 #define CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX 16 #define CONFIG_UPROBES 1 #define CONFIG_IR_SHARP_DECODER 1 #define CONFIG_ARCH_SPARSEMEM_ENABLE 1 #define CONFIG_IR_NEC_DECODER 1 #define CONFIG_HOTPLUG_CPU 1 #define CONFIG_PM_SLEEP_DEBUG 1 #define CONFIG_WLAN 1 #define CONFIG_NAMESPACES 1 #define CONFIG_HAVE_CMPXCHG_DOUBLE 1 #define CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY 1 #define CONFIG_BLK_DEV_BSG 1 #define CONFIG_CONNECTOR 1 #define CONFIG_PCIEAER 1 #define CONFIG_INTEGRITY 1 #define CONFIG_CRYPTO_DRBG_MENU 1 #define CONFIG_CRYPTO_RNG2 1 #define CONFIG_THERMAL_WRITABLE_TRIPS 1 #define CONFIG_MSDOS_FS 1 #define CONFIG_CFG80211 1 #define CONFIG_SERIAL_8250 1 #define CONFIG_LZO_DECOMPRESS 1 #define CONFIG_IOMMU_SUPPORT 1 #define CONFIG_HID_BELKIN 1 #define CONFIG_WLAN_VENDOR_CISCO 1 #define CONFIG_RD_LZMA 1 #define CONFIG_USB 1 #define CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK 1 #define CONFIG_CRYPTO_HMAC 1 #define CONFIG_WLAN_VENDOR_REALTEK 1 #define CONFIG_ETHERNET 1 #define CONFIG_SCHED_OMIT_FRAME_POINTER 1 #define CONFIG_BRANCH_PROFILE_NONE 1 #define CONFIG_SND_HRTIMER 1 #define CONFIG_HAVE_DMA_CONTIGUOUS 1 #define CONFIG_DQL 1 #define CONFIG_FRAMEBUFFER_CONSOLE 1 #define CONFIG_DM_ZERO 1 #define CONFIG_SND_SEQUENCER 1 #define CONFIG_COREDUMP 1 #define CONFIG_HID_CHERRY 1 #define CONFIG_HID_SUNPLUS 1 #define CONFIG_BCMA_POSSIBLE 1 #define CONFIG_NF_LOG_IPV4_MODULE 1 #define CONFIG_VGA_ARB 1 #define CONFIG_MODULES_USE_ELF_REL 1 #define CONFIG_NET_POLL_CONTROLLER 1 #define CONFIG_PRINTK 1 #define CONFIG_FORCEDETH 1 #define CONFIG_FB_SYS_FILLRECT 1 #define CONFIG_TIMERFD 1 #define CONFIG_DNS_RESOLVER 1 #define CONFIG_TRACEPOINTS 1 #define CONFIG_CRYPTO_AUTHENC 1 #define CONFIG_YENTA 1 #define CONFIG_NET_EMATCH_STACK 32 #define CONFIG_BOUNCE 1 #define CONFIG_SHMEM 1 #define CONFIG_MIGRATION 1 #define CONFIG_HAVE_ARCH_JUMP_LABEL 1 #define CONFIG_DECOMPRESS_LZMA 1 #define CONFIG_DEVTMPFS_MOUNT 1 #define CONFIG_DNOTIFY 1 #define CONFIG_GENERIC_NET_UTILS 1 #define CONFIG_ATA 1 #define CONFIG_CRYPTO_DES 1 #define CONFIG_ENABLE_MUST_CHECK 1 #define CONFIG_NLS_CODEPAGE_437 1 #define CONFIG_HYPERV_KEYBOARD 1 #define CONFIG_EXPORTFS 1 #define CONFIG_SND_MIXER_OSS 1 #define CONFIG_NET_INGRESS 1 #define CONFIG_OLD_SIGSUSPEND3 1 #define CONFIG_SERIO 1 #define CONFIG_SCHEDSTATS 1 #define CONFIG_INPUT_MOUSE 1 #define CONFIG_FB_SYS_IMAGEBLIT 1 #define CONFIG_X86 1 #define CONFIG_ARCH_HAS_SG_CHAIN 1 #define CONFIG_SUNRPC_GSS 1 #define CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS 1 #define CONFIG_TIGON3 1 #define CONFIG_NETCONSOLE 1 #define CONFIG_RTC_INTF_SYSFS 1 #define CONFIG_CPU_FREQ_GOV_COMMON 1 #define CONFIG_BLK_DEV_INITRD 1 #define CONFIG_X86_MCE_AMD 1 #define CONFIG_SND_OSSEMUL 1 #define CONFIG_ARCH_CLOCKSOURCE_DATA 1 #define CONFIG_ZLIB_INFLATE 1 #define CONFIG_NET_VENDOR_SYNOPSYS 1 #define CONFIG_HWMON 1 #define CONFIG_INTEL_GTT 1 #define CONFIG_NET_VENDOR_DLINK 1 #define CONFIG_AUDITSYSCALL 1 #define CONFIG_LOGO_LINUX_CLUT224 1 #define CONFIG_X86_ACPI_CPUFREQ_CPB 1 #define CONFIG_IP_PNP 1 #define CONFIG_CLKBLD_I8253 1 #define CONFIG_RTC_INTF_PROC 1 #define CONFIG_PM_CLK 1 #define CONFIG_ARCH_USE_BUILTIN_BSWAP 1 #define CONFIG_PERF_EVENTS_INTEL_RAPL 1 #define CONFIG_CPU_IDLE_GOV_MENU 1 #define CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL 1 #define CONFIG_SERIAL_8250_LPSS 1 #define CONFIG_ACPI_FAN 1 #define CONFIG_STACKTRACE_SUPPORT 1 #define CONFIG_PCI_BIOS 1 #define CONFIG_RCU_TRACE 1 #define CONFIG_OUTPUT_FORMAT "elf32-i386" #define CONFIG_ACPI 1 #define CONFIG_USB_UHCI_HCD 1 #define CONFIG_NVRAM 1 #define CONFIG_LOCKD 1 #define CONFIG_DRM_KMS_FB_HELPER 1 #define CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC 1 #define CONFIG_SOUND_OSS_CORE 1 #define CONFIG_WLAN_VENDOR_RALINK 1 #define CONFIG_CRYPTO_KPP2 1 #define CONFIG_MTRR 1 #define CONFIG_NO_HZ_IDLE 1 #define CONFIG_NET_VENDOR_ADAPTEC 1 #define CONFIG_CFG80211_REQUIRE_SIGNED_REGDB 1 #define CONFIG_MOUSE_PS2_BYD 1 #define CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING 1 #define CONFIG_BSD_PROCESS_ACCT 1 #define CONFIG_INPUT_TABLET 1 #define CONFIG_CRYPTO_DRBG_HMAC 1 #define CONFIG_DRM_BRIDGE 1 #define CONFIG_HPET_EMULATE_RTC 1 #define CONFIG_X86_MPPARSE 1 #define CONFIG_LOGO 1 #define CONFIG_NET_VENDOR_SILAN 1 #define CONFIG_EEEPC_LAPTOP 1 #define CONFIG_USB_STORAGE 1 #define CONFIG_NET_VENDOR_BROADCOM 1 #define CONFIG_GENERIC_CPU_AUTOPROBE 1 #define CONFIG_STANDALONE 1 #define CONFIG_SCHED_MC 1 #define CONFIG_CPU_FREQ_GOV_PERFORMANCE 1 #define CONFIG_EFI 1 #define CONFIG_RATIONAL 1 #define CONFIG_AGP_AMD64 1 #define CONFIG_WLAN_VENDOR_INTEL 1 #define CONFIG_HAVE_SETUP_PER_CPU_AREA 1 #define CONFIG_DRM_I915_USERPTR 1 #define CONFIG_SYSTEM_TRUSTED_KEYRING 1 #define CONFIG_GENERIC_EARLY_IOREMAP 1 #define CONFIG_IO_DELAY_TYPE_0XED 1 #define CONFIG_BLOCK 1 #define CONFIG_HAVE_IDE 1 #define CONFIG_HID_APPLE 1 #define CONFIG_INIT_ENV_ARG_LIMIT 32 #define CONFIG_ROOT_NFS 1 #define CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH 1 #define CONFIG_CPU_SUP_INTEL 1 #define CONFIG_TMPFS_POSIX_ACL 1 #define CONFIG_STRICT_KERNEL_RWX 1 #define CONFIG_PROVIDE_OHCI1394_DMA_INIT 1 #define CONFIG_BUG 1 #define CONFIG_CONTEXT_SWITCH_TRACER 1 #define CONFIG_MAC80211_HAS_RC 1 #define CONFIG_LOGIWHEELS_FF 1 #define CONFIG_PANTHERLORD_FF 1 #define CONFIG_PM 1 #define CONFIG_PPS 1 #define CONFIG_GENERIC_ISA_DMA 1 #define CONFIG_RTC_SYSTOHC_DEVICE "rtc0" #define CONFIG_NF_CONNTRACK_IRC 1 #define CONFIG_USELIB 1 #define CONFIG_VT 1 #define CONFIG_PCI_ATS 1 #define CONFIG_DMA_ACPI 1 #define CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED 1 #define CONFIG_SPLIT_PTLOCK_CPUS 4 #define CONFIG_SBITMAP 1 #define CONFIG_POWER_SUPPLY 1 #define CONFIG_SECURITY_SELINUX_BOOTPARAM 1 #define CONFIG_HAVE_RCU_TABLE_FREE 1 #define CONFIG_NETLABEL 1 #define CONFIG_NLS 1 #define CONFIG_NETFILTER_XT_TARGET_SECMARK 1 #define CONFIG_X86_INTEL_PSTATE 1 #define CONFIG_ZONE_DMA 1 #define CONFIG_ACPI_I2C_OPREGION 1 #define CONFIG_SND_SEQ_DEVICE 1 #define CONFIG_SUN_PARTITION 1 #define CONFIG_SYN_COOKIES 1 #define CONFIG_IRQ_WORK 1 #define CONFIG_PCI_MSI 1 #define CONFIG_IP_ADVANCED_ROUTER 1 #define CONFIG_FB_SYS_COPYAREA 1 #define CONFIG_USB_EHCI_PCI 1 #define CONFIG_NET_VENDOR_FUJITSU 1 #define CONFIG_USB_COMMON 1 #define CONFIG_TASK_XACCT 1 #define CONFIG_IP6_NF_IPTABLES 1 #define CONFIG_ARCH_DEFCONFIG "arch/x86/configs/i386_defconfig" #define CONFIG_CPU_FREQ_GOV_USERSPACE 1 #define CONFIG_LOG_CPU_MAX_BUF_SHIFT 12 #define CONFIG_BLK_DEV_DM_BUILTIN 1 #define CONFIG_VGA_ARB_MAX_GPUS 16 #define CONFIG_PCMCIA 1 #define CONFIG_EVENT_TRACING 1 #define CONFIG_NET_CADENCE 1 #define CONFIG_HID_CYPRESS 1 #define CONFIG_SG_POOL 1 #define CONFIG_DRM_KMS_HELPER 1 #define CONFIG_BLK_MQ_PCI 1 #define CONFIG_PREEMPT_VOLUNTARY 1 #define CONFIG_NLS_ISO8859_1 1 #define CONFIG_CRYPTO_WORKQUEUE 1 #define CONFIG_MACINTOSH_DRIVERS 1 #define CONFIG_R8169 1 #define CONFIG_HAVE_ATOMIC_IOMAP 1 #define CONFIG_HID_KENSINGTON 1 #define CONFIG_BACKLIGHT_GENERIC 1 #define CONFIG_USB_EHCI_HCD 1 #define CONFIG_FS_IOMAP 1 #define CONFIG_8139TOO 1 #define CONFIG_NF_CONNTRACK_PROCFS 1 #define CONFIG_SND_PCM_OSS 1 #define CONFIG_RFKILL 1 #define CONFIG_NETDEVICES 1 #define CONFIG_IOSCHED_DEADLINE 1 #define CONFIG_CLKSRC_I8253 1 #define CONFIG_CGROUP_FREEZER 1 #define CONFIG_EVENTFD 1 #define CONFIG_FS_POSIX_ACL 1 #define CONFIG_IPV6_SIT 1 #define CONFIG_XFRM 1 #define CONFIG_DEFCONFIG_LIST "/lib/modules/$UNAME_RELEASE/.config" #define CONFIG_HAVE_KPROBES_ON_FTRACE 1 #define CONFIG_YENTA_TOSHIBA 1 #define CONFIG_SERIAL_8250_CONSOLE 1 #define CONFIG_USB_ANNOUNCE_NEW_DEVICES 1 #define CONFIG_JUMP_LABEL 1 #define CONFIG_IP_NF_TARGET_MASQUERADE_MODULE 1 #define CONFIG_UIO_HV_GENERIC 1 #define CONFIG_SECURITY_SELINUX_DISABLE 1 #define CONFIG_PROC_PAGE_MONITOR 1 #define CONFIG_SERIAL_8250_EXTENDED 1 #define CONFIG_SERIAL_8250_DETECT_IRQ 1 #define CONFIG_BPF 1 #define CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK 1 #define CONFIG_X86_CMOV 1 #define CONFIG_ACPI_HOTPLUG_CPU 1 #define CONFIG_PM_TRACE_RTC 1 #define CONFIG_RD_LZO 1 #define CONFIG_NEED_NODE_MEMMAP_SIZE 1 #define CONFIG_KPROBE_EVENTS 1 #define CONFIG_SCSI_SPI_ATTRS 1 #define CONFIG_MICROCODE_AMD 1 #define CONFIG_NF_CONNTRACK_SECMARK 1 #define CONFIG_INSTRUCTION_DECODER 1 #define CONFIG_BACKLIGHT_CLASS_DEVICE 1 #define CONFIG_NET_VENDOR_EXAR 1 #define CONFIG_CRYPTO_NULL 1 #define CONFIG_NET_VENDOR_SEEQ 1 #define CONFIG_NF_DEFRAG_IPV4 1 #define CONFIG_INTEL_IOMMU_FLOPPY_WA 1 #define CONFIG_SELECT_MEMORY_MODEL 1 #define CONFIG_PM_DEBUG 1 #define CONFIG_GENERIC_STRNLEN_USER 1 #define CONFIG_WLAN_VENDOR_RSI 1 #define CONFIG_CRYPTO_JITTERENTROPY 1 #define CONFIG_CRYPTO_GCM 1 #define CONFIG_NETFILTER_NETLINK_LOG 1 #define CONFIG_HAVE_DYNAMIC_FTRACE 1 #define CONFIG_CDROM 1 #define CONFIG_MAGIC_SYSRQ 1 #define CONFIG_E100 1 #define CONFIG_IO_DELAY_0X80 1 #define CONFIG_DMI 1 #define CONFIG_NET_VENDOR_RDC 1 #define CONFIG_PGTABLE_LEVELS 2 #define CONFIG_CPUSETS 1 #define CONFIG_MAC80211_RC_DEFAULT_MINSTREL 1 #define CONFIG_SPARSE_IRQ 1 #define CONFIG_IP_NF_MANGLE 1 #define CONFIG_DEFAULT_CFQ 1 #define CONFIG_RCU_STALL_COMMON 1 #define CONFIG_CPU_SUP_AMD 1 #define CONFIG_INET6_XFRM_MODE_TUNNEL 1 #define CONFIG_PCIEPORTBUS 1 #define CONFIG_DEBUG_BUGVERBOSE 1 #define CONFIG_IP_NF_FILTER 1 #define CONFIG_MODULES_TREE_LOOKUP 1 #define CONFIG_FAT_FS 1 #define CONFIG_SND_HDA_INTEL 1 #define CONFIG_MAY_USE_DEVLINK 1 #define CONFIG_THIN_ARCHIVES 1 #define CONFIG_HIGHMEM 1 #define CONFIG_NVMEM 1 #define CONFIG_INET_TUNNEL 1 #define CONFIG_X86_INTERNODE_CACHE_SHIFT 5 #define CONFIG_NF_LOG_ARP_MODULE 1 #define CONFIG_X86_CHECK_BIOS_CORRUPTION 1 #define CONFIG_GENERIC_CLOCKEVENTS 1 #define CONFIG_IOSCHED_CFQ 1 #define CONFIG_OID_REGISTRY 1 #define CONFIG_RWSEM_XCHGADD_ALGORITHM 1 #define CONFIG_HAVE_KERNEL_XZ 1 #define CONFIG_X86_PKG_TEMP_THERMAL_MODULE 1 #define CONFIG_RFKILL_LEDS 1 #define CONFIG_CONSOLE_TRANSLATIONS 1 #define CONFIG_ARCH_SUPPORTS_ATOMIC_RMW 1 #define CONFIG_SND_X86 1 #define CONFIG_PCMCIA_LOAD_CIS 1 #define CONFIG_SERIAL_EARLYCON 1 #define CONFIG_DEBUG_DEVRES 1 #define CONFIG_CRYPTO_AKCIPHER 1 #define CONFIG_ACPI_CPU_FREQ_PSS 1 #define CONFIG_CPU_FREQ 1 #define CONFIG_USB_OHCI_HCD 1 #define CONFIG_DM_MIRROR 1 #define CONFIG_DUMMY_CONSOLE 1 #define CONFIG_USB_PCI 1 #define CONFIG_NLS_ASCII 1 #define CONFIG_PARAVIRT_DEBUG 1 #define CONFIG_NF_REJECT_IPV4 1 #define CONFIG_ARCH_MMAP_RND_BITS_MAX 16 #define CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE 1 #define CONFIG_TRACE_IRQFLAGS_SUPPORT 1 #define CONFIG_NFS_V3_ACL 1 #define CONFIG_CRYPTO_CCM 1 #define CONFIG_TCP_CONG_ADVANCED 1 #define CONFIG_KVM_GUEST 1 #define CONFIG_QFMT_V2 1 #define CONFIG_LEDS_TRIGGERS 1 #define CONFIG_CRYPTO_RNG 1 #define CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN 8 #define CONFIG_SND_USB 1 #define CONFIG_RD_GZIP 1 #define CONFIG_ARCH_HAS_CPU_RELAX 1 #define CONFIG_HAVE_REGS_AND_STACK_ACCESS_API 1 #define CONFIG_MDIO_BUS 1 #define CONFIG_TREE_RCU 1 #define CONFIG_ALLOW_DEV_COREDUMP 1 #define CONFIG_LBDAF 1 #define CONFIG_EXT4_FS_SECURITY 1 #define CONFIG_GRO_CELLS 1 #define CONFIG_IR_XMP_DECODER 1 #define CONFIG_PCI_MSI_IRQ_DOMAIN 1 #define CONFIG_NET_VENDOR_HP 1 #define CONFIG_CRYPTO_MD5 1 #define CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE 1 #define CONFIG_ATA_ACPI 1 #define CONFIG_X86_EXTENDED_PLATFORM 1 #define CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE 1 #define CONFIG_ACPI_PROCESSOR 1 #define CONFIG_ELFCORE 1 #define CONFIG_HAVE_KVM 1 #define CONFIG_PCCARD 1 #define CONFIG_BINFMT_ELF 1 #define CONFIG_AUDIT_GENERIC 1 #define CONFIG_SCSI_PROC_FS 1 #define CONFIG_HAVE_PERF_REGS 1 #define CONFIG_IP_PIMSM_V1 1 #define CONFIG_INET6_AH 1 #define CONFIG_CC_STACKPROTECTOR_NONE 1 #define CONFIG_NET_VENDOR_ALTEON 1 #define CONFIG_USB_MON 1 #define CONFIG_NET_VENDOR_RENESAS 1 #define CONFIG_KEYS 1 #define CONFIG_ACPI_PROCESSOR_CSTATE 1 #define CONFIG_SND_VMASTER 1 #define CONFIG_NETFILTER_XT_MARK_MODULE 1 #define CONFIG_NETFILTER_XTABLES 1 #define CONFIG_CRYPTO_ECHAINIV 1 #define CONFIG_HAVE_ARCH_AUDITSYSCALL 1 #define CONFIG_PM_SLEEP_SMP 1 #define CONFIG_X86_16BIT 1 #define CONFIG_CRYPTO_HW 1 #define CONFIG_X86_VERBOSE_BOOTUP 1 #define CONFIG_MAC80211_RC_MINSTREL_HT 1 #define CONFIG_PCSPKR_PLATFORM 1 #define CONFIG_CARDBUS 1 #define CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE 0x1 #define CONFIG_ACPI_AC 1 #define CONFIG_TLS 1 #define CONFIG_ACPI_HOTPLUG_IOAPIC 1 #define CONFIG_VT_HW_CONSOLE_BINDING 1 #define CONFIG_SND_SEQUENCER_OSS 1 #define CONFIG_HID_GYRATION 1 #define CONFIG_THERMAL_HWMON 1 #define CONFIG_XZ_DEC_X86 1 #define CONFIG_MAC80211_LEDS 1 #define CONFIG_HIBERNATE_CALLBACKS 1 #define CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS 0 #define CONFIG_X86_32 1 #define CONFIG_CRC16 1 #define CONFIG_GENERIC_CALIBRATE_DELAY 1 #define CONFIG_CRYPTO_GF128MUL 1 #define CONFIG_UPROBE_EVENTS 1 #define CONFIG_NET_CLS 1 #define CONFIG_TMPFS 1 #define CONFIG_ANON_INODES 1 #define CONFIG_FUTEX 1 #define CONFIG_IP_PNP_DHCP 1 #define CONFIG_CONSOLE_LOGLEVEL_DEFAULT 7 #define CONFIG_REGMAP_I2C 1 #define CONFIG_M686 1 #define CONFIG_ARCH_HAS_FAST_MULTIPLIER 1 #define CONFIG_NET_VENDOR_REALTEK 1 #define CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG 1 #define CONFIG_DRM_I915_CAPTURE_ERROR 1 #define CONFIG_SECURITY_NETWORK 1 #define CONFIG_SERIAL_CORE_CONSOLE 1 #define CONFIG_HUGETLB_PAGE 1 #define CONFIG_NET_VENDOR_EMULEX 1 #define CONFIG_USB_HID 1 #define CONFIG_USER_STACKTRACE_SUPPORT 1 #define CONFIG_SLUB_DEBUG 1 #define CONFIG_BLK_DEV_MD 1 #define CONFIG_UCS2_STRING 1 #define CONFIG_MAC_EMUMOUSEBTN 1 #define CONFIG_DMADEVICES 1 #define CONFIG_IPV6_NDISC_NODETYPE 1 #define CONFIG_PCI_LABEL 1 #define CONFIG_BLK_DEV_SR_VENDOR 1 #define CONFIG_SGETMASK_SYSCALL 1 #define CONFIG_CGROUP_SCHED 1 #define CONFIG_QUEUED_RWLOCKS 1 #define CONFIG_SYSVIPC 1 #define CONFIG_HAVE_DEBUG_KMEMLEAK 1 #define CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT 13 #define CONFIG_NF_CONNTRACK_FTP 1 #define CONFIG_MODULES 1 #define CONFIG_MQ_IOSCHED_DEADLINE 1 #define CONFIG_USB_HIDDEV 1 #define CONFIG_IOMMU_IOVA 1 #define CONFIG_DUMMY_CONSOLE_COLUMNS 80 #define CONFIG_SOUND 1 #define CONFIG_JOLIET 1 #define CONFIG_KPROBES_ON_FTRACE 1 #define CONFIG_AUDIT_WATCH 1 #define CONFIG_ARCH_HIBERNATION_POSSIBLE 1 #define CONFIG_UNIX 1 #define CONFIG_USB_NET_DRIVERS 1 #define CONFIG_NO_HZ_COMMON 1 #define CONFIG_DRM_MIPI_DSI 1 #define CONFIG_HAVE_CLK 1 #define CONFIG_CRYPTO_HASH2 1 #define CONFIG_THERMAL_GOV_STEP_WISE 1 #define CONFIG_DEFAULT_HOSTNAME "(none)" #define CONFIG_SRCU 1 #define CONFIG_NFS_FS 1 #define CONFIG_CRASH_DUMP 1 #define CONFIG_MEMBARRIER 1 #define CONFIG_BLK_DEV_IO_TRACE 1 #define CONFIG_XPS 1 #define CONFIG_SECURITY_SELINUX_DEVELOP 1 #define CONFIG_HPET_TIMER 1 #define CONFIG_LZ4_DECOMPRESS 1 #define CONFIG_EFI_RUNTIME_MAP 1 #define CONFIG_NF_CONNTRACK_IPV6 1 #define CONFIG_FONT_SUPPORT 1 #define CONFIG_ADVISE_SYSCALLS 1 #define CONFIG_MD 1 #define CONFIG_CRYPTO_ALGAPI 1 #define CONFIG_FDDI 1 #define CONFIG_NET_VENDOR_WIZNET 1 #define CONFIG_SERIAL_8250_MID 1 #define CONFIG_RD_BZIP2 1 #define CONFIG_UNWINDER_FRAME_POINTER 1 #define CONFIG_X86_INTEL_UMIP 1 #define CONFIG_KEYBOARD_ATKBD 1 #define CONFIG_HAVE_MEMBLOCK_NODE_MAP 1 #define CONFIG_X86_PLATFORM_DEVICES 1 #define CONFIG_NET_IP_TUNNEL 1 #define CONFIG_NF_NAT_MODULE 1 #define CONFIG_NET_VENDOR_OKI 1 #define CONFIG_CPU_IDLE 1 #define CONFIG_WLAN_VENDOR_INTERSIL 1 #define CONFIG_NFS_COMMON 1 #define CONFIG_FAIR_GROUP_SCHED 1 #define CONFIG_CRYPTO_HASH 1 #define CONFIG_EFI_PARTITION 1 #define CONFIG_PROBE_EVENTS 1 #define CONFIG_TRACE_CLOCK 1 #define CONFIG_LOG_BUF_SHIFT 18 #define CONFIG_WLAN_VENDOR_ATH 1 #define CONFIG_HZ_1000 1 #define CONFIG_HPET 1 #define CONFIG_SOUND_OSS_CORE_PRECLAIM 1 #define CONFIG_EXTRA_FIRMWARE "" #define CONFIG_NET_VENDOR_8390 1 #define CONFIG_PROC_EVENTS 1 #define CONFIG_ACPI_VIDEO 1 #define CONFIG_VIRT_TO_BUS 1 #define CONFIG_VFAT_FS 1 #define CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE 0 #define CONFIG_PID_NS 1 #define CONFIG_KEXEC 1 #define CONFIG_CRC32_SLICEBY8 1 #define CONFIG_BLK_DEV_SR 1 #define CONFIG_CPU_RMAP 1 #define CONFIG_SND_HWDEP 1 #define CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR 1 #define CONFIG_BLK_DEV_LOOP 1 #define CONFIG_HAVE_OPTPROBES 1 #define CONFIG_HAVE_FENTRY 1 #define CONFIG_HYPERV_UTILS 1 #define CONFIG_NF_NAT_IRC_MODULE 1 #define CONFIG_INPUT_MISC 1 #define CONFIG_E1000E 1 #define CONFIG_MULTIUSER 1 #define CONFIG_SUSPEND 1 #define CONFIG_CROSS_MEMORY_ATTACH 1 #define CONFIG_CRYPTO_CBC 1 #define CONFIG_I8253_LOCK 1 #define CONFIG_SERIAL_8250_RUNTIME_UARTS 4 #define CONFIG_KPROBES 1 #define CONFIG_FS_MBCACHE 1 #define CONFIG_RTC_CLASS 1 #define CONFIG_CRYPTO_RNG_DEFAULT 1 #define CONFIG_TMPFS_XATTR 1 #define CONFIG_EXT4_USE_FOR_EXT2 1 #define CONFIG_I2C_I801 1 #define CONFIG_MICROCODE_OLD_INTERFACE 1 #define CONFIG_GENERIC_TRACER 1 #define CONFIG_CFG80211_USE_KERNEL_REGDB_KEYS 1 #define CONFIG_HAVE_FUNCTION_TRACER 1 #define CONFIG_CPU_ISOLATION 1 #define CONFIG_ARCH_SELECT_MEMORY_MODEL 1 #define CONFIG_TOUCHSCREEN_PROPERTIES 1 #define CONFIG_CRYPTO_MANAGER2 1 #define CONFIG_SERIAL_8250_DEPRECATED_OPTIONS 1 #define CONFIG_NET_VENDOR_MYRI 1 #define CONFIG_CLZ_TAB 1 #define CONFIG_GENERIC_PCI_IOMAP 1 #define CONFIG_NETFILTER_XT_TARGET_LOG_MODULE 1 #define CONFIG_SLUB 1 #define CONFIG_XZ_DEC_BCJ 1 #define CONFIG_PM_SLEEP 1 #define CONFIG_I2C 1 #define CONFIG_EDAC_DECODE_MCE 1 #define CONFIG_BINFMT_SCRIPT 1 #define CONFIG_MOUSE_PS2_CYPRESS 1 #define CONFIG_GENERIC_PENDING_IRQ 1 #define CONFIG_X86_NEED_RELOCS 1 #define CONFIG_EARLY_PRINTK_DBGP 1 #define CONFIG_FRAME_POINTER 1 #define CONFIG_MOUSE_PS2_LOGIPS2PP 1 #define CONFIG_TICK_CPU_ACCOUNTING 1 #define CONFIG_VM_EVENT_COUNTERS 1 #define CONFIG_RELAY 1 #define CONFIG_HAVE_MMIOTRACE_SUPPORT 1 #define CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT 1 #define CONFIG_WLAN_VENDOR_BROADCOM 1 #define CONFIG_PM_STD_PARTITION "" #define CONFIG_NET_VENDOR_XIRCOM 1 #define CONFIG_GENERIC_FIND_FIRST_BIT 1 #define CONFIG_DEBUG_FS 1 #define CONFIG_NET_VENDOR_AMD 1 #define CONFIG_HAVE_KERNEL_LZ4 1 #define CONFIG_BASE_FULL 1 #define CONFIG_FB_CFB_IMAGEBLIT 1 #define CONFIG_ZLIB_DEFLATE 1 #define CONFIG_SUNRPC 1 #define CONFIG_SOLARIS_X86_PARTITION 1 #define CONFIG_ARCH_DISCARD_MEMBLOCK 1 #define CONFIG_ACPI_TABLE_UPGRADE 1 #define CONFIG_OSF_PARTITION 1 #define CONFIG_X86_32_LAZY_GS 1 #define CONFIG_FW_LOADER 1 #define CONFIG_SECURITY_WRITABLE_HOOKS 1 #define CONFIG_KALLSYMS 1 #define CONFIG_COMMON_CLK 1 #define CONFIG_PCI 1 #define CONFIG_DECOMPRESS_XZ 1 #define CONFIG_PCI_QUIRKS 1 #define CONFIG_MII 1 #define CONFIG_SIGNALFD 1 #define CONFIG_NET_CORE 1 #define CONFIG_MOUSE_PS2_ALPS 1 #define CONFIG_KEXEC_CORE 1 #define CONFIG_HAVE_UNSTABLE_SCHED_CLOCK 1 #define CONFIG_EXT4_FS 1 #define CONFIG_HAVE_HW_BREAKPOINT 1 #define CONFIG_ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT 1 #define CONFIG_KRETPROBES 1 #define CONFIG_SND_JACK_INPUT_DEV 1 #define CONFIG_CRYPTO_SHA1 1 #define CONFIG_ARCH_WANT_GENERAL_HUGETLB 1 #define CONFIG_XZ_DEC 1 #define CONFIG_SATA_PMP 1 #define CONFIG_NET_VENDOR_TI 1 #define CONFIG_LOCKD_V4 1 #define CONFIG_NET_VENDOR_ALACRITECH 1 #define CONFIG_WATCHDOG 1 #define CONFIG_HAS_IOMEM 1 #define CONFIG_NF_LOG_IPV6_MODULE 1 #define CONFIG_CRYPTO_RSA 1 #define CONFIG_GENERIC_IRQ_PROBE 1 #define CONFIG_CRYPTO_ACOMP2 1 #define CONFIG_PCI_MMCONFIG 1 #define CONFIG_PM_TRACE 1 #define CONFIG_PROC_KCORE 1 #define CONFIG_RETPOLINE 1 #define CONFIG_SCHED_HRTICK 1 #define CONFIG_EPOLL 1 #define CONFIG_SND_PCM 1 #define CONFIG_SND_SEQ_MIDI_EVENT 1 #define CONFIG_PARTITION_ADVANCED 1 #define CONFIG_UNIXWARE_DISKLABEL 1 #define CONFIG_HAVE_NET_DSA 1 #define CONFIG_IR_SONY_DECODER 1 #define CONFIG_NET 1 #define CONFIG_USB_OHCI_HCD_PCI 1 #define CONFIG_INPUT_EVDEV 1 #define CONFIG_SND_JACK 1 #define CONFIG_NETFILTER_XT_TARGET_TCPMSS 1 #define CONFIG_ACPI_SLEEP 1 #define CONFIG_NETFILTER_XT_MATCH_CONNTRACK 1 #define CONFIG_QUOTA_TREE 1 #define CONFIG_IRQ_DOMAIN_HIERARCHY 1 #define CONFIG_MPILIB 1 #define CONFIG_PACKET 1 #define CONFIG_XFRM_ALGO 1 #define CONFIG_HAVE_CLK_PREPARE 1 #define CONFIG_CRYPTO_AKCIPHER2 1 #define CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE 1 #define CONFIG_SND_HDA_CORE 1 #define CONFIG_DUMMY_CONSOLE_ROWS 25 #define CONFIG_NFS_V3 1 #define CONFIG_NOP_TRACER 1 #define CONFIG_BACKLIGHT_LCD_SUPPORT 1 #define CONFIG_INET 1 #define CONFIG_IP_ROUTE_VERBOSE 1 #define CONFIG_XZ_DEC_POWERPC 1 #define CONFIG_IP_PNP_BOOTP 1 #define CONFIG_NETFILTER_XT_MATCH_ADDRTYPE_MODULE 1 #define CONFIG_NET_VENDOR_HUAWEI 1 #define CONFIG_PREVENT_FIRMWARE_BUILD 1 #define CONFIG_SERIAL_8250_PNP 1 #define CONFIG_FREEZER 1 #define CONFIG_HAVE_HARDLOCKUP_DETECTOR_PERF 1 #define CONFIG_PCI_DOMAINS 1 #define CONFIG_EFI_VARS 1 #define CONFIG_NET_CLS_ACT 1 #define CONFIG_NET_VENDOR_CHELSIO 1 #define CONFIG_EFIVAR_FS_MODULE 1 #define CONFIG_X86_DEBUGCTLMSR 1 #define CONFIG_8139TOO_PIO 1 #define CONFIG_SND_PCMCIA 1 #define CONFIG_RTC_LIB 1 #define CONFIG_X86_LOCAL_APIC 1 #define CONFIG_NETFILTER_XT_MATCH_POLICY 1 #define CONFIG_HAVE_KPROBES 1 #define CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS 1 #define CONFIG_CRYPTO_AES 1 #define CONFIG_FUTEX_PI 1 #define CONFIG_GENERIC_CPU_VULNERABILITIES 1 #define CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES 1 #define CONFIG_HID_PID 1 #define CONFIG_ISO9660_FS 1 #define CONFIG_SKY2 1 #define CONFIG_NETFILTER_XT_NAT_MODULE 1 #define CONFIG_UIO 1 #define CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR 1 #define CONFIG_NET_VENDOR_AQUANTIA 1 #define CONFIG_NETFILTER 1 #define CONFIG_X86_MSR 1 #define CONFIG_NET_VENDOR_SMSC 1 #define CONFIG_SERIO_SERPORT 1 #define CONFIG_CLONE_BACKWARDS 1 #define CONFIG_HAVE_NMI 1 #define CONFIG_RD_XZ 1 #define CONFIG_IP_MROUTE 1 #define CONFIG_X86_SMAP 1 #define CONFIG_VGA_CONSOLE 1 #define CONFIG_NF_NAT_NEEDED 1 #define CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS 1 #define CONFIG_ATA_VERBOSE_ERROR 1 #define CONFIG_SND_DRIVERS 1 #define CONFIG_PRINTK_NMI 1 #define CONFIG_NET_FLOW_LIMIT 1 #define CONFIG_LOCKDEP_SUPPORT 1 #define CONFIG_ACPI_PROCESSOR_IDLE 1 #define CONFIG_NO_HZ 1 #define CONFIG_ARCH_WANT_HUGE_PMD_SHARE 1 #define CONFIG_POSIX_MQUEUE 1 #define CONFIG_NETFILTER_INGRESS 1 #define CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT 1 #define CONFIG_PMC_ATOM 1 #define CONFIG_X86_ESPFIX32 1 #define CONFIG_ARCH_MIGHT_HAVE_PC_SERIO 1 #define CONFIG_GENERIC_STRNCPY_FROM_USER 1 #define CONFIG_SND_PCM_OSS_PLUGINS 1 #define CONFIG_CRASH_CORE 1 #define CONFIG_NET_VENDOR_DEC 1 #define CONFIG_INET6_ESP 1 #define CONFIG_AUTOFS4_FS 1 #define CONFIG_ACPI_BUTTON 1 #define CONFIG_ILLEGAL_POINTER_VALUE 0x0 #define CONFIG_TASKSTATS 1 #define CONFIG_IP6_NF_FILTER 1 #define CONFIG_SYSTEM_DATA_VERIFICATION 1 #define CONFIG_EFI_ESRT 1 #define CONFIG_NEED_DMA_MAP_STATE 1 #define CONFIG_SND_HDA 1 #define CONFIG_SND_HDA_PREALLOC_SIZE 64 #define CONFIG_YENTA_ENE_TUNE 1 #define CONFIG_MOUSE_PS2_LIFEBOOK 1 #define CONFIG_SERIO_LIBPS2 1 #define CONFIG_X86_CPUID 1 #define CONFIG_PAGE_OFFSET 0xC0000000 #define CONFIG_USB_PRINTER 1 #define CONFIG_FONT_8x8 1 #define CONFIG_NET_VENDOR_ATHEROS 1 #define CONFIG_RELOCATABLE 1 #define CONFIG_QUEUED_SPINLOCKS 1 #define CONFIG_DMIID 1 #define CONFIG_NET_VENDOR_SUN 1 #define CONFIG_ARCH_HAS_MEM_ENCRYPT 1 #define CONFIG_PANIC_TIMEOUT 0 #define CONFIG_QUOTA_NETLINK_INTERFACE 1 #define CONFIG_INPUT_JOYSTICK 1 #define CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT 1 #define CONFIG_SPARSEMEM_STATIC 1 #define CONFIG_NF_NAT_MASQUERADE_IPV4_MODULE 1 #define CONFIG_CFG80211_DEFAULT_PS 1 #define CONFIG_GENERIC_IOMAP 1 #define CONFIG_DECOMPRESS_LZ4 1 #define CONFIG_SPARSEMEM_MANUAL 1 #define CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK 1 #define CONFIG_SMP 1 #define CONFIG_TTY 1 #define CONFIG_HAVE_KERNEL_GZIP 1 #define CONFIG_X86_USE_PPRO_CHECKSUM 1 #define CONFIG_NET_VENDOR_I825XX 1 #define CONFIG_PNP 1 #define CONFIG_DW_DMAC_CORE 1 #define CONFIG_NETFILTER_XT_TARGET_NFLOG 1 #define CONFIG_GENERIC_ALLOCATOR 1 #define CONFIG_GENERIC_BUG 1 #define CONFIG_CRYPTO_SHA256 1 #define CONFIG_HAVE_FTRACE_MCOUNT_RECORD 1 #define CONFIG_POSIX_TIMERS 1 #define CONFIG_HID_SONY 1 #define CONFIG_PCI_PASID 1 #define CONFIG_HW_CONSOLE 1 #define CONFIG_RAS 1 #define CONFIG_DEVMEM 1 #define CONFIG_MOUSE_PS2_FOCALTECH 1 #define CONFIG_HID_MONTEREY 1 #define CONFIG_HID_EZKEY 1 #define CONFIG_IOSCHED_NOOP 1 #define CONFIG_THERMAL_GOV_USER_SPACE 1 #define CONFIG_EFI_CAPSULE_LOADER 1 #define CONFIG_HAVE_UID16 1 #define CONFIG_SERIAL_NONSTANDARD 1 #define CONFIG_RTC_NVMEM 1 #define CONFIG_X86_FEATURE_NAMES 1 #define CONFIG_QUOTACTL 1 #define CONFIG_PARAVIRT 1 #define CONFIG_HAVE_IOREMAP_PROT 1 #define CONFIG_DEBUG_KERNEL 1 #define CONFIG_LOCALVERSION "" #define CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK 1 #define CONFIG_HAVE_PCSPKR_PLATFORM 1 #define CONFIG_CRYPTO 1 #define CONFIG_FUNCTION_TRACER 1 #define CONFIG_CPU_SUP_TRANSMETA_32 1 #define CONFIG_NET_VENDOR_BROCADE 1 #define CONFIG_DEFAULT_MMAP_MIN_ADDR 4096 #define CONFIG_SYSTEM_TRUSTED_KEYS "" #define CONFIG_PERF_EVENTS_INTEL_UNCORE 1 #define CONFIG_SND_HDA_HWDEP 1 #define CONFIG_IP_NF_IPTABLES 1 #define CONFIG_DYNAMIC_FTRACE_WITH_REGS 1 #define CONFIG_NET_VENDOR_QLOGIC 1 #define CONFIG_HAVE_DMA_API_DEBUG 1 #define CONFIG_DEFAULT_CUBIC 1 #define CONFIG_YENTA_TI 1 #define CONFIG_HID_SAMSUNG 1 #define CONFIG_IP_PIMSM_V2 1 #define CONFIG_X86_MCE_THRESHOLD 1 #define CONFIG_DMA_VIRTUAL_CHANNELS 1 #define CONFIG_YENTA_O2 1 #define CONFIG_GENERIC_MSI_IRQ_DOMAIN 1 #define CONFIG_SND_SEQ_HRTIMER_DEFAULT 1 #define CONFIG_USB_ARCH_HAS_HCD 1 #define CONFIG_PATA_OLDPIIX 1 #define CONFIG_GENERIC_IRQ_SHOW 1 #define CONFIG_ARCH_HAS_ELF_RANDOMIZE 1 #define CONFIG_MD_AUTODETECT 1 #define CONFIG_PANIC_ON_OOPS_VALUE 0 #define CONFIG_NET_VENDOR_SAMSUNG 1 #define CONFIG_SCSI_MOD 1 #define CONFIG_NET_VENDOR_MICREL 1 #define CONFIG_AUDIT_TREE 1 #define CONFIG_HID_ITE 1 #define CONFIG_RC_DECODERS 1 #define CONFIG_CRYPTO_CRC32C 1 #define CONFIG_SERIAL_CORE 1 #define CONFIG_BUILDTIME_EXTABLE_SORT 1 #define CONFIG_UID16 1 #define CONFIG_HAVE_DEBUG_STACKOVERFLOW 1 #define CONFIG_HID_MICROSOFT 1 #define CONFIG_PCC 1 #define CONFIG_HAVE_KRETPROBES 1 #define CONFIG_HYPERV_BALLOON 1 #define CONFIG_ASSOCIATIVE_ARRAY 1 #define CONFIG_NF_DEFRAG_IPV6 1 #define CONFIG_NFS_V4 1 #define CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE 1 #define CONFIG_DYNAMIC_FTRACE 1 #define CONFIG_MAILBOX 1 #define CONFIG_INPUT_LEDS 1 #define CONFIG_RCU_NEED_SEGCBLIST 1 #define CONFIG_INLINE_READ_UNLOCK 1 #define CONFIG_HAS_DMA 1 #define CONFIG_EDAC 1 #define CONFIG_DEBUG_BOOT_PARAMS 1 #define CONFIG_IO_DELAY_TYPE_NONE 3 #define CONFIG_SCSI 1 #define CONFIG_FB_CFB_FILLRECT 1 #define CONFIG_HYPERV 1 #define CONFIG_FUNCTION_GRAPH_TRACER 1 #define CONFIG_HID_CHICONY 1 #define CONFIG_HID 1 #define CONFIG_I2C_SMBUS 1 #define CONFIG_CLKDEV_LOOKUP 1 #define CONFIG_FONT_8x16 1 #define CONFIG_NET_VENDOR_MELLANOX 1 #define CONFIG_SERIAL_8250_MANY_PORTS 1 #define CONFIG_VT_CONSOLE_SLEEP 1 #define CONFIG_X86_MCE_INTEL 1 #define CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG 1 #define CONFIG_RTC_DRV_CMOS 1 #define CONFIG_PCI_LOCKLESS_CONFIG 1 #define CONFIG_PTP_1588_CLOCK 1 #define CONFIG_PATA_AMD 1 #define CONFIG_DEBUG_STACK_USAGE 1 #define CONFIG_ARCH_HAS_CACHE_LINE_SIZE 1 #define CONFIG_JBD2 1 #define CONFIG_NET_VENDOR_MARVELL 1 #define CONFIG_PHYLIB 1 #define CONFIG_NET_VENDOR_NVIDIA 1 #define CONFIG_HAVE_GENERIC_GUP 1 #define CONFIG_FB_CMDLINE 1 #define CONFIG_OPTIMIZE_INLINING 1 #define CONFIG_IRQ_DOMAIN 1 #define CONFIG_LSM_MMAP_MIN_ADDR 65536 #define CONFIG_INTEGRITY_AUDIT 1 #define CONFIG_ARCH_HAS_DEBUG_VIRTUAL 1 #define CONFIG_NET_TULIP 1 #define CONFIG_IPC_NS 1 #define CONFIG_MISC_FILESYSTEMS 1 #define CONFIG_ARCH_MMAP_RND_BITS_MIN 8 #define CONFIG_FTRACE 1 #define CONFIG_X86_THERMAL_VECTOR 1 #define CONFIG_HAVE_CC_STACKPROTECTOR 1 #define CONFIG_COMPAT_32 1 #define CONFIG_CLOCKSOURCE_WATCHDOG 1 #define CONFIG_HID_TOPSEED 1 #define CONFIG_DECOMPRESS_BZIP2 1 #define CONFIG_ARCH_SUPPORTS_UPROBES 1 #define CONFIG_NET_VENDOR_STMICRO 1 #define CONFIG_XZ_DEC_SPARC 1 #define CONFIG_INLINE_READ_UNLOCK_IRQ 1 #define CONFIG_HID_HYPERV_MOUSE 1 #define CONFIG_PROC_VMCORE 1 #define CONFIG_HID_A4TECH 1 #define CONFIG_RTC_MC146818_LIB 1 #define CONFIG_DST_CACHE 1 #define CONFIG_NF_REJECT_IPV6 1 #define CONFIG_RCU_CPU_STALL_TIMEOUT 21 #define CONFIG_SND_VERBOSE_PROCFS 1 #define CONFIG_IP_ROUTE_MULTIPATH 1 #define CONFIG_INPUT_FF_MEMLESS 1 #define CONFIG_PARAVIRT_CLOCK 1 #define CONFIG_CHR_DEV_SG 1 #define CONFIG_SECTION_MISMATCH_WARN_ONLY 1 #define CONFIG_MDIO_DEVICE 1 #define CONFIG_X86_RESERVE_LOW 64 #define CONFIG_NEED_SG_DMA_LENGTH 1 #define CONFIG_IP6_NF_MATCH_IPV6HEADER 1 #define CONFIG_PCIEASPM_DEFAULT 1 #define CONFIG_PROFILING 1 #define CONFIG_INTERVAL_TREE 1 #define CONFIG_IOSF_MBI 1 #define CONFIG_NET_VENDOR_AMAZON 1 #define CONFIG_SPARSEMEM 1 #define CONFIG_INET6_XFRM_MODE_TRANSPORT 1 #define CONFIG_CRYPTO_ARC4 1 #define CONFIG_WLAN_VENDOR_ATMEL 1 #define CONFIG_GRACE_PERIOD 1 #define CONFIG_NET_VENDOR_TEHUTI 1 #define CONFIG_E1000E_HWTS 1 #define CONFIG_CRYPTO_MANAGER 1 #define CONFIG_SCHED_SMT 1 #define CONFIG_EDAC_SUPPORT 1 #define CONFIG_RT_MUTEXES 1 #define CONFIG_LOCK_SPIN_ON_OWNER 1 #define CONFIG_HUGETLBFS 1 #define CONFIG_CHECK_SIGNATURE 1 #define CONFIG_SLAB_MERGE_DEFAULT 1 #define CONFIG_KERNFS 1 #define CONFIG_I2C_ALGOBIT 1 #define CONFIG_SND_PCI 1 #define CONFIG_IR_SANYO_DECODER 1 #define CONFIG_DMAR_TABLE 1 #define CONFIG_CFG80211_CRDA_SUPPORT 1 #define CONFIG_WIRELESS 1 #define CONFIG_X86_IO_APIC 1 #define CONFIG_ARCH_HAS_STRICT_KERNEL_RWX 1 #define CONFIG_PKCS7_MESSAGE_PARSER 1 #define CONFIG_TASK_IO_ACCOUNTING 1 #define CONFIG_FAT_DEFAULT_IOCHARSET "iso8859-1" #define CONFIG_FRAME_WARN 2048 #define CONFIG_NET_VENDOR_AGERE 1 #define CONFIG_HID_GENERIC 1 #define CONFIG_ARCH_MMAP_RND_BITS 8 #define CONFIG_PATA_SCH 1 #define CONFIG_GENERIC_HWEIGHT 1 #define CONFIG_INITRAMFS_SOURCE "" #define CONFIG_RTL_CARDS 1 #define CONFIG_CGROUPS 1 #define CONFIG_LZO_COMPRESS 1 #define CONFIG_DAX 1 #define CONFIG_CRYPTO_SEQIV 1 #define CONFIG_SND_HDA_POWER_SAVE_DEFAULT 0 #define CONFIG_HID_LOGITECH 1 #define CONFIG_HAVE_GCC_PLUGINS 1 #define CONFIG_STACKTRACE 1 #define CONFIG_HAVE_ACPI_APEI 1 #define CONFIG_OPROFILE_NMI_TIMER 1 #define CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC 1 #define CONFIG_CRYPTO_DRBG 1 #define CONFIG_WLAN_VENDOR_ADMTEK 1 #define CONFIG_CGROUP_CPUACCT 1 #define CONFIG_HAS_IOPORT_MAP 1 #define CONFIG_X86_CMPXCHG64 1 #define CONFIG_NET_VENDOR_VIA 1 #define CONFIG_ISA_DMA_API 1 #define CONFIG_HZ 1000 #define CONFIG_SERIAL_8250_SHARE_IRQ 1 #define CONFIG_I2C_HELPER_AUTO 1 #define CONFIG_AGP_INTEL 1 #define CONFIG_INLINE_SPIN_UNLOCK_IRQ 1 #define CONFIG_SERIAL_8250_NR_UARTS 32 #define CONFIG_ARCH_HAS_STRICT_MODULE_RWX 1 #define CONFIG_NET_VENDOR_ARC 1 #define CONFIG_SCHED_MC_PRIO 1 #define CONFIG_HAVE_USER_RETURN_NOTIFIER 1 #define CONFIG_DEFAULT_IOSCHED "cfq" #define CONFIG_HAVE_PERF_USER_STACK_DUMP 1 #define CONFIG_NLATTR 1 #define CONFIG_HOTPLUG_PCI 1 #define CONFIG_TCP_CONG_CUBIC 1 #define CONFIG_NR_CPUS 8 #define CONFIG_SUSPEND_FREEZER 1 #define CONFIG_HAVE_EXIT_THREAD 1 #define CONFIG_SND_SUPPORT_OLD_API 1 #define CONFIG_LOGITECH_FF 1 #define CONFIG_MOUSE_PS2_TRACKPOINT 1 #define CONFIG_FIRMWARE_IN_KERNEL 1 #define CONFIG_SYSFS 1 #define CONFIG_USB_DEFAULT_PERSIST 1 #define CONFIG_INPUT_TOUCHSCREEN 1 #define CONFIG_EDAC_LEGACY_SYSFS 1 #define CONFIG_DRM_PANEL_BRIDGE 1 #define CONFIG_HIGHMEM4G 1 #define CONFIG_ASN1 1 #define CONFIG_NF_LOG_COMMON_MODULE 1 #define CONFIG_XZ_DEC_ARM 1 #define CONFIG_DEFAULT_IO_DELAY_TYPE 0 #define CONFIG_CRYPTO_HASH_INFO 1 #define CONFIG_FB_SYS_FOPS 1 #define CONFIG_BLK_SCSI_REQUEST 1 #define CONFIG_HAVE_SYSCALL_TRACEPOINTS 1 #define CONFIG_ACPI_BATTERY 1 #define CONFIG_FB 1 #define CONFIG_TRACING 1 #define CONFIG_I2C_COMPAT 1 #define CONFIG_WLAN_VENDOR_ZYDAS 1 #define CONFIG_FTRACE_MCOUNT_RECORD 1 #define CONFIG_VIRTUALIZATION 1 #define CONFIG_MSDOS_PARTITION 1 #define CONFIG_RTC_I2C_AND_SPI 1 #define CONFIG_HAVE_OPROFILE 1 #define CONFIG_HAVE_GENERIC_DMA_COHERENT 1 #define CONFIG_THERMAL 1 #define CONFIG_SYNC_FILE 1 #define CONFIG_IP_PNP_RARP 1 #define CONFIG_OLD_SIGACTION 1 #define CONFIG_NET_VENDOR_3COM 1 #define CONFIG_HID_PETALYNX 1 #define CONFIG_HAVE_ARCH_KGDB 1 #define CONFIG_VGACON_SOFT_SCROLLBACK_SIZE 64 #define CONFIG_ARCH_USE_QUEUED_SPINLOCKS 1 #define CONFIG_NF_CONNTRACK_IPV4 1 #define CONFIG_BLK_DEBUG_FS 1 #define CONFIG_X86_PM_TIMER 1 #define CONFIG_X86_DEBUG_FPU 1 #define CONFIG_NET_VENDOR_INTEL 1 #define CONFIG_RPS 1 #define CONFIG_SERIAL_8250_EXAR 1 #define CONFIG_PROC_PID_CPUSET 1 #define CONFIG_HYPERVISOR_GUEST 1 #define CONFIG_ZISOFS 1 #define CONFIG_WLAN_VENDOR_MEDIATEK 1 #define CONFIG_IP_MULTICAST 1 #define CONFIG_GENERIC_CMOS_UPDATE 1 #define CONFIG_NET_VENDOR_CISCO 1 #define CONFIG_DEFAULT_SECURITY "selinux" #define CONFIG_TICK_ONESHOT 1 #define CONFIG_CRYPTO_CTR 1 #define CONFIG_MODVERSIONS 1 #define CONFIG_HW_RANDOM 1 #define CONFIG_MUTEX_SPIN_ON_OWNER 1 #define CONFIG_IO_DELAY_TYPE_0X80 0 #define CONFIG_AMIGA_PARTITION 1 #define CONFIG_EARLY_PRINTK 1 #define CONFIG_NF_NAT_IPV4_MODULE 1 #define CONFIG_HAVE_FUNCTION_GRAPH_TRACER 1 #define CONFIG_HW_RANDOM_VIA 1 #define CONFIG_HAVE_CMPXCHG_LOCAL 1 #define CONFIG_TREE_SRCU 1 #define CONFIG_CRYPTO_NULL2 1 #define CONFIG_ACPI_THERMAL 1 #define CONFIG_ARCH_HAS_ACPI_TABLE_UPGRADE 1 #define CONFIG_SERIAL_8250_DMA 1 #define CONFIG_BASE_SMALL 0 #define CONFIG_CRYPTO_BLKCIPHER2 1 #define CONFIG_SECURITY_SELINUX_AVC_STATS 1 #define CONFIG_SND_SEQ_DUMMY 1 #define CONFIG_COMPACTION 1 #define CONFIG_NFS_V2 1 #define CONFIG_PROC_FS 1 #define CONFIG_NET_PACKET_ENGINE 1 #define CONFIG_RC_MAP 1 #define CONFIG_NET_VENDOR_ROCKER 1 #define CONFIG_IRQ_FORCED_THREADING 1 #define CONFIG_EDAC_ATOMIC_SCRUB 1 #define CONFIG_CRYPTO_CMAC 1 #define CONFIG_HW_RANDOM_GEODE 1 #define CONFIG_HID_PANTHERLORD 1 #define CONFIG_DRM_FBDEV_EMULATION 1 #define CONFIG_SND 1 #define CONFIG_IR_RC6_DECODER 1 #define CONFIG_DEBUG_STACKOVERFLOW 1 #define CONFIG_RFKILL_INPUT 1 #define CONFIG_NET_VENDOR_NATSEMI 1 #define CONFIG_GENERIC_IRQ_MIGRATION 1 #define CONFIG_NET_VENDOR_NETRONOME 1 #define CONFIG_NFS_USE_KERNEL_DNS 1 #define CONFIG_ARCH_HAS_FORTIFY_SOURCE 1 #define CONFIG_SND_HDA_I915 1 #define CONFIG_SYSCTL 1 #define CONFIG_ARCH_HAS_GCOV_PROFILE_ALL 1 #define CONFIG_THREAD_INFO_IN_TASK 1 #define CONFIG_HAVE_C_RECORDMCOUNT 1 #define CONFIG_GENERIC_MSI_IRQ 1 #define CONFIG_HAVE_ARCH_TRACEHOOK 1 #define CONFIG_DRM_FBDEV_OVERALLOC 100 #define CONFIG_XFRM_USER 1 #define CONFIG_TASK_DELAY_ACCT 1 #define CONFIG_NET_NS 1 #define CONFIG_EFI_CAPSULE_QUIRK_QUARK_CSH 1 #define CONFIG_HAVE_PERF_EVENTS 1 #define CONFIG_ATA_SFF 1 #define CONFIG_HAVE_ALIGNED_STRUCT_PAGE 1 #define CONFIG_NO_BOOTMEM 1 #define CONFIG_NET_VENDOR_SOLARFLARE 1 #define CONFIG_DEBUG_MEMORY_INIT 1 #define CONFIG_AUDIT 1 #define CONFIG_INTEL_IOMMU 1 #define CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE 1 #define CONFIG_PCIEASPM 1 #define CONFIG_ATA_PIIX 1 #define CONFIG_ARM_GIC_MAX_NR 1 #define CONFIG_FB_DEFERRED_IO 1 #define CONFIG_SATA_AHCI 1 #define CONFIG_SECURITY 1 #define CONFIG_OPTPROBES 1 #define CONFIG_X86_32_SMP 1 #define CONFIG_SND_TIMER 1 #define CONFIG_USB_EHCI_TT_NEWSCHED 1 #define CONFIG_FAT_DEFAULT_CODEPAGE 437 #define CONFIG_BLK_DEV 1 #define CONFIG_SERIO_I8042 1 #define CONFIG_MAC80211_RC_DEFAULT "minstrel_ht" #define CONFIG_NFS_ACL_SUPPORT 1 #define CONFIG_IOMMU_API 1 #define CONFIG_TRACING_SUPPORT 1 #define CONFIG_UNIX98_PTYS 1 #define CONFIG_MINIX_SUBPARTITION 1 #define CONFIG_NET_RX_BUSY_POLL 1 #define CONFIG_SECURITY_SELINUX 1 #define CONFIG_NET_SCHED 1 #define CONFIG_NETFILTER_XT_TARGET_CONNSECMARK 1 #define CONFIG_DRM_PANEL 1 #define CONFIG_PRINTK_TIME 1 #define CONFIG_SECCOMP_FILTER 1 #define CONFIG_UIO_PCI_GENERIC 1 #define CONFIG_ARCH_MAY_HAVE_PC_FDC 1 #define CONFIG_HAVE_KERNEL_LZO 1 #define CONFIG_CRYPTO_GHASH 1 #define CONFIG_NF_NAT_FTP_MODULE 1 #define CONFIG_MAC80211_RC_MINSTREL 1 #define CONFIG_IO_DELAY_TYPE_UDELAY 2 #define CONFIG_ELF_CORE 1 #define CONFIG_ACPI_DOCK 1 #define CONFIG_USB_SUPPORT 1 #define CONFIG_INPUT_POLLDEV 1 #define CONFIG_MODIFY_LDT_SYSCALL 1 #define CONFIG_WLAN_VENDOR_ST 1 #define CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS 1 #define CONFIG_NET_VENDOR_SIS 1 #define CONFIG_VT_CONSOLE 1 #define CONFIG_SCHED_INFO 1 #define CONFIG_MQ_IOSCHED_KYBER 1 #define CONFIG_WLAN_VENDOR_MARVELL 1 #define CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE 1 #define CONFIG_NETFILTER_XT_MATCH_STATE 1 #define CONFIG_BSD_DISKLABEL 1 #define CONFIG_IR_RC5_DECODER 1 #define CONFIG_PCI_DIRECT 1 #define CONFIG_DRM 1 #define CONFIG_DOUBLEFAULT 1 #define CONFIG_INET6_XFRM_MODE_BEET 1 #define CONFIG_POSIX_MQUEUE_SYSCTL 1 #define CONFIG_FB_CFB_COPYAREA 1 #define CONFIG_FB_EFI 1 #define CONFIG_MANDATORY_FILE_LOCKING 1 #define CONFIG_BINARY_PRINTF 1 #define CONFIG_ACPI_REV_OVERRIDE_POSSIBLE 1 #define CONFIG_SGI_PARTITION 1 #define CONFIG_INPUT_SPARSEKMAP 1 #define CONFIG_PCI_GOANY 1 #define CONFIG_SYSFS_SYSCALL 1 #define CONFIG_WLAN_VENDOR_QUANTENNA 1 #define CONFIG_SND_PCM_TIMER 1 #define CONFIG_SYSVIPC_SYSCTL 1 #define CONFIG_WLAN_VENDOR_TI 1 #define CONFIG_HID_NTRIG 1 #define CONFIG_DMA_SHARED_BUFFER 1 #define CONFIG_RTC_SYSTOHC 1 #define CONFIG_DECOMPRESS_GZIP 1 #define CONFIG_DECOMPRESS_LZO 1 #define CONFIG_QUOTA 1 #define CONFIG_CROSS_COMPILE "" #define CONFIG_ARCH_USE_QUEUED_RWLOCKS 1 #define CONFIG_NETWORK_SECMARK 1 #define CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 1 #define CONFIG_ARCH_RANDOM 1 #define CONFIG_SERIAL_8250_PCI 1 #define CONFIG_HAVE_MIXED_BREAKPOINTS_REGS 1 #define CONFIG_MOUSE_PS2_SYNAPTICS 1 #define CONFIG_ATA_BMDMA 1 #define CONFIG_XZ_DEC_ARMTHUMB 1 #define CONFIG_REGMAP 1 #define CONFIG_NLS_UTF8 1 #define CONFIG_PCIE_PME 1 #define CONFIG_HAVE_MOD_ARCH_SPECIFIC 1 #define CONFIG_FB_NOTIFY 1 #define CONFIG_STRICT_MODULE_RWX 1 #define CONFIG_PCCARD_NONSTATIC 1 #define CONFIG_CPU_SUP_CENTAUR 1 #define CONFIG_HAVE_INTEL_TXT 1 #define CONFIG_HAMRADIO 1 #define CONFIG_SYSCTL_EXCEPTION_TRACE 1 #define CONFIG_FHANDLE 1 #define CONFIG_NEW_LEDS 1 #define CONFIG_SWAP 1 #define CONFIG_MICROCODE_INTEL 1 #define CONFIG_X86_FAST_FEATURE_TESTS 1 #define CONFIG_MAC80211 1 #define CONFIG_ARCH_USES_PG_UNCACHED 1 #define CONFIG_CRC_CCITT 1 #define CONFIG_NET_VENDOR_CAVIUM 1 #define CONFIG_BLK_DEV_SD 1 #define CONFIG_PHYSICAL_ALIGN 0x200000 #define CONFIG_ACPI_LEGACY_TABLES_LOOKUP 1 #define CONFIG_NETFILTER_NETLINK 1 #define CONFIG_MODULE_UNLOAD 1 #define CONFIG_HAVE_ACPI_APEI_NMI 1 #define CONFIG_RWSEM_SPIN_ON_OWNER 1 #define CONFIG_BITREVERSE 1 #define CONFIG_DEVPORT 1 #define CONFIG_DRM_I915_COMPRESS_ERROR 1 #define CONFIG_X509_CERTIFICATE_PARSER 1 #define CONFIG_MAC_PARTITION 1 #define CONFIG_EARLY_PRINTK_USB 1 #define CONFIG_PTP_1588_CLOCK_KVM 1 #define CONFIG_FB_MODE_HELPERS 1 #define CONFIG_PCI_PRI 1 #define CONFIG_CRYPTO_BLKCIPHER 1 #define CONFIG_X86_L1_CACHE_SHIFT 5 #define CONFIG_X86_PAT 1 #define CONFIG_PNP_DEBUG_MESSAGES 1 #define CONFIG_NF_CONNTRACK 1 #define CONFIG_ARCH_HAS_REFCOUNT 1 #define CONFIG_EFI_RUNTIME_WRAPPERS 1 #define CONFIG_FILE_LOCKING 1 #define CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST 1 #define CONFIG_KARMA_PARTITION 1 #define CONFIG_NETPOLL 1 #define CONFIG_AIO 1 #define CONFIG_CLKEVT_I8253 1 #define CONFIG_NET_EMATCH 1 #define CONFIG_PERF_EVENTS 1 #define CONFIG_GENERIC_TIME_VSYSCALL 1 #define CONFIG_IP_NF_TARGET_REJECT 1 #define CONFIG_LEDS_CLASS 1 #define CONFIG_PERF_EVENTS_INTEL_CSTATE 1 #define CONFIG_KALLSYMS_BASE_RELATIVE 1 #define CONFIG_RTC_INTF_DEV 1 #define CONFIG_DCACHE_WORD_ACCESS 1 #define CONFIG_MESSAGE_LOGLEVEL_DEFAULT 4 #define CONFIG_AMD_NB 1 #define CONFIG_NLS_DEFAULT "utf8" #define CONFIG_ACPI_CONTAINER 1 #define CONFIG_SND_DMA_SGBUF 1 #define CONFIG_UTS_NS 1 #define CONFIG_NF_CT_NETLINK 1 #define CONFIG_DMA_ENGINE 1 #define CONFIG_X86_ACPI_CPUFREQ 1 #define CONFIG_DEFAULT_SECURITY_SELINUX 1 #define CONFIG_DEBUG_INFO 1 #define CONFIG_CRYPTO_AEAD2 1 #define CONFIG_MOUSE_PS2 1 #define CONFIG_CRYPTO_ALGAPI2 1 #define CONFIG_PHYSICAL_START 0x1000000 #define CONFIG_GENERIC_IRQ_RESERVATION_MODE 1 #define CONFIG_HAVE_MEMBLOCK 1 #define CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS 1 #define CONFIG_INPUT 1 #define CONFIG_PROC_SYSCTL 1 #define CONFIG_HAVE_PERF_EVENTS_NMI 1 #define CONFIG_RD_LZ4 1 #define CONFIG_MMU 1 #define CONFIG_VGACON_SOFT_SCROLLBACK 1 #define CONFIG_AGP 1 #define CONFIG_INLINE_WRITE_UNLOCK 1 #define CONFIG_E1000 1 # 6 "././include/linux/kconfig.h" 2 #define __ARG_PLACEHOLDER_1 0, #define __take_second_arg(__ignored, val, ...) val /* * The use of "&&" / "||" is limited in certain expressions. * The following enable to calculate "and" / "or" with macro expansion only. */ #define __and(x, y) ___and(x, y) #define ___and(x, y) ____and(__ARG_PLACEHOLDER_##x, y) #define ____and(arg1_or_junk, y) __take_second_arg(arg1_or_junk y, 0) #define __or(x, y) ___or(x, y) #define ___or(x, y) ____or(__ARG_PLACEHOLDER_##x, y) #define ____or(arg1_or_junk, y) __take_second_arg(arg1_or_junk 1, y) /* * Helper macros to use CONFIG_ options in C/CPP expressions. Note that * these only work with boolean and tristate options. */ /* * Getting something that works in C and CPP for an arg that may or may * not be defined is tricky. Here, if we have "#define CONFIG_BOOGER 1" * we match on the placeholder define, insert the "0," for arg1 and generate * the triplet (0, 1, 0). Then the last step cherry picks the 2nd arg (a one). * When CONFIG_BOOGER is not defined, we generate a (... 1, 0) pair, and when * the last step cherry picks the 2nd arg, we get a zero. */ #define __is_defined(x) ___is_defined(x) #define ___is_defined(val) ____is_defined(__ARG_PLACEHOLDER_##val) #define ____is_defined(arg1_or_junk) __take_second_arg(arg1_or_junk 1, 0) /* * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0 * otherwise. For boolean options, this is equivalent to * IS_ENABLED(CONFIG_FOO). */ #define IS_BUILTIN(option) __is_defined(option) /* * IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0 * otherwise. */ #define IS_MODULE(option) __is_defined(option##_MODULE) /* * IS_REACHABLE(CONFIG_FOO) evaluates to 1 if the currently compiled * code can call a function defined in code compiled based on CONFIG_FOO. * This is similar to IS_ENABLED(), but returns false when invoked from * built-in code when CONFIG_FOO is set to 'm'. */ #define IS_REACHABLE(option) __or(IS_BUILTIN(option), \ __and(IS_MODULE(option), __is_defined(MODULE))) /* * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm', * 0 otherwise. */ #define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option)) #endif /* __LINUX_KCONFIG_H */ # 68 "././include/linux/kconfig.h" # 1 "" 2 # 1 "drivers/gpu/drm/i915/i915_perf.c" /* * Copyright © 2015-2016 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Authors: * Robert Bragg */ /** * DOC: i915 Perf Overview * * Gen graphics supports a large number of performance counters that can help * driver and application developers understand and optimize their use of the * GPU. * * This i915 perf interface enables userspace to configure and open a file * descriptor representing a stream of GPU metrics which can then be read() as * a stream of sample records. * * The interface is particularly suited to exposing buffered metrics that are * captured by DMA from the GPU, unsynchronized with and unrelated to the CPU. * * Streams representing a single context are accessible to applications with a * corresponding drm file descriptor, such that OpenGL can use the interface * without special privileges. Access to system-wide metrics requires root * privileges by default, unless changed via the dev.i915.perf_event_paranoid * sysctl option. * */ /** * DOC: i915 Perf History and Comparison with Core Perf * * The interface was initially inspired by the core Perf infrastructure but * some notable differences are: * * i915 perf file descriptors represent a "stream" instead of an "event"; where * a perf event primarily corresponds to a single 64bit value, while a stream * might sample sets of tightly-coupled counters, depending on the * configuration. For example the Gen OA unit isn't designed to support * orthogonal configurations of individual counters; it's configured for a set * of related counters. Samples for an i915 perf stream capturing OA metrics * will include a set of counter values packed in a compact HW specific format. * The OA unit supports a number of different packing formats which can be * selected by the user opening the stream. Perf has support for grouping * events, but each event in the group is configured, validated and * authenticated individually with separate system calls. * * i915 perf stream configurations are provided as an array of u64 (key,value) * pairs, instead of a fixed struct with multiple miscellaneous config members, * interleaved with event-type specific members. * * i915 perf doesn't support exposing metrics via an mmap'd circular buffer. * The supported metrics are being written to memory by the GPU unsynchronized * with the CPU, using HW specific packing formats for counter sets. Sometimes * the constraints on HW configuration require reports to be filtered before it * would be acceptable to expose them to unprivileged applications - to hide * the metrics of other processes/contexts. For these use cases a read() based * interface is a good fit, and provides an opportunity to filter data as it * gets copied from the GPU mapped buffers to userspace buffers. * * * Issues hit with first prototype based on Core Perf * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * The first prototype of this driver was based on the core perf * infrastructure, and while we did make that mostly work, with some changes to * perf, we found we were breaking or working around too many assumptions baked * into perf's currently cpu centric design. * * In the end we didn't see a clear benefit to making perf's implementation and * interface more complex by changing design assumptions while we knew we still * wouldn't be able to use any existing perf based userspace tools. * * Also considering the Gen specific nature of the Observability hardware and * how userspace will sometimes need to combine i915 perf OA metrics with * side-band OA data captured via MI_REPORT_PERF_COUNT commands; we're * expecting the interface to be used by a platform specific userspace such as * OpenGL or tools. This is to say; we aren't inherently missing out on having * a standard vendor/architecture agnostic interface by not using perf. * * * For posterity, in case we might re-visit trying to adapt core perf to be * better suited to exposing i915 metrics these were the main pain points we * hit: * * - The perf based OA PMU driver broke some significant design assumptions: * * Existing perf pmus are used for profiling work on a cpu and we were * introducing the idea of _IS_DEVICE pmus with different security * implications, the need to fake cpu-related data (such as user/kernel * registers) to fit with perf's current design, and adding _DEVICE records * as a way to forward device-specific status records. * * The OA unit writes reports of counters into a circular buffer, without * involvement from the CPU, making our PMU driver the first of a kind. * * Given the way we were periodically forward data from the GPU-mapped, OA * buffer to perf's buffer, those bursts of sample writes looked to perf like * we were sampling too fast and so we had to subvert its throttling checks. * * Perf supports groups of counters and allows those to be read via * transactions internally but transactions currently seem designed to be * explicitly initiated from the cpu (say in response to a userspace read()) * and while we could pull a report out of the OA buffer we can't * trigger a report from the cpu on demand. * * Related to being report based; the OA counters are configured in HW as a * set while perf generally expects counter configurations to be orthogonal. * Although counters can be associated with a group leader as they are * opened, there's no clear precedent for being able to provide group-wide * configuration attributes (for example we want to let userspace choose the * OA unit report format used to capture all counters in a set, or specify a * GPU context to filter metrics on). We avoided using perf's grouping * feature and forwarded OA reports to userspace via perf's 'raw' sample * field. This suited our userspace well considering how coupled the counters * are when dealing with normalizing. It would be inconvenient to split * counters up into separate events, only to require userspace to recombine * them. For Mesa it's also convenient to be forwarded raw, periodic reports * for combining with the side-band raw reports it captures using * MI_REPORT_PERF_COUNT commands. * * - As a side note on perf's grouping feature; there was also some concern * that using PERF_FORMAT_GROUP as a way to pack together counter values * would quite drastically inflate our sample sizes, which would likely * lower the effective sampling resolutions we could use when the available * memory bandwidth is limited. * * With the OA unit's report formats, counters are packed together as 32 * or 40bit values, with the largest report size being 256 bytes. * * PERF_FORMAT_GROUP values are 64bit, but there doesn't appear to be a * documented ordering to the values, implying PERF_FORMAT_ID must also be * used to add a 64bit ID before each value; giving 16 bytes per counter. * * Related to counter orthogonality; we can't time share the OA unit, while * event scheduling is a central design idea within perf for allowing * userspace to open + enable more events than can be configured in HW at any * one time. The OA unit is not designed to allow re-configuration while in * use. We can't reconfigure the OA unit without losing internal OA unit * state which we can't access explicitly to save and restore. Reconfiguring * the OA unit is also relatively slow, involving ~100 register writes. From * userspace Mesa also depends on a stable OA configuration when emitting * MI_REPORT_PERF_COUNT commands and importantly the OA unit can't be * disabled while there are outstanding MI_RPC commands lest we hang the * command streamer. * * The contents of sample records aren't extensible by device drivers (i.e. * the sample_type bits). As an example; Sourab Gupta had been looking to * attach GPU timestamps to our OA samples. We were shoehorning OA reports * into sample records by using the 'raw' field, but it's tricky to pack more * than one thing into this field because events/core.c currently only lets a * pmu give a single raw data pointer plus len which will be copied into the * ring buffer. To include more than the OA report we'd have to copy the * report into an intermediate larger buffer. I'd been considering allowing a * vector of data+len values to be specified for copying the raw data, but * it felt like a kludge to being using the raw field for this purpose. * * - It felt like our perf based PMU was making some technical compromises * just for the sake of using perf: * * perf_event_open() requires events to either relate to a pid or a specific * cpu core, while our device pmu related to neither. Events opened with a * pid will be automatically enabled/disabled according to the scheduling of * that process - so not appropriate for us. When an event is related to a * cpu id, perf ensures pmu methods will be invoked via an inter process * interrupt on that core. To avoid invasive changes our userspace opened OA * perf events for a specific cpu. This was workable but it meant the * majority of the OA driver ran in atomic context, including all OA report * forwarding, which wasn't really necessary in our case and seems to make * our locking requirements somewhat complex as we handled the interaction * with the rest of the i915 driver. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 194 "drivers/gpu/drm/i915/i915_perf.c" # 1 "./include/linux/anon_inodes.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ /* * include/linux/anon_inodes.h * * Copyright (C) 2007 Davide Libenzi * */ #ifndef _LINUX_ANON_INODES_H #define _LINUX_ANON_INODES_H struct file_operations; struct file *anon_inode_getfile(const char *name, const struct file_operations *fops, void *priv, int flags); int anon_inode_getfd(const char *name, const struct file_operations *fops, void *priv, int flags); #endif /* _LINUX_ANON_INODES_H */ # 21 "./include/linux/anon_inodes.h" # 195 "drivers/gpu/drm/i915/i915_perf.c" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 195 "drivers/gpu/drm/i915/i915_perf.c" # 1 "./include/linux/sizes.h" 1 /* * include/linux/sizes.h * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __LINUX_SIZES_H__ #define __LINUX_SIZES_H__ #define SZ_1 0x00000001 #define SZ_2 0x00000002 #define SZ_4 0x00000004 #define SZ_8 0x00000008 #define SZ_16 0x00000010 #define SZ_32 0x00000020 #define SZ_64 0x00000040 #define SZ_128 0x00000080 #define SZ_256 0x00000100 #define SZ_512 0x00000200 #define SZ_1K 0x00000400 #define SZ_2K 0x00000800 #define SZ_4K 0x00001000 #define SZ_8K 0x00002000 #define SZ_16K 0x00004000 #define SZ_32K 0x00008000 #define SZ_64K 0x00010000 #define SZ_128K 0x00020000 #define SZ_256K 0x00040000 #define SZ_512K 0x00080000 #define SZ_1M 0x00100000 #define SZ_2M 0x00200000 #define SZ_4M 0x00400000 #define SZ_8M 0x00800000 #define SZ_16M 0x01000000 #define SZ_32M 0x02000000 #define SZ_64M 0x04000000 #define SZ_128M 0x08000000 #define SZ_256M 0x10000000 #define SZ_512M 0x20000000 #define SZ_1G 0x40000000 #define SZ_2G 0x80000000 #endif /* __LINUX_SIZES_H__ */ # 48 "./include/linux/sizes.h" # 196 "drivers/gpu/drm/i915/i915_perf.c" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 196 "drivers/gpu/drm/i915/i915_perf.c" # 1 "./include/linux/uuid.h" 1 /* * UUID/GUID definition * * Copyright (C) 2010, 2016 Intel Corp. * Huang Ying * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 as published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef _LINUX_UUID_H_ #define _LINUX_UUID_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 19 "./include/linux/uuid.h" # 1 "./include/uapi/linux/uuid.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * UUID/GUID definition * * Copyright (C) 2010, Intel Corp. * Huang Ying * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 as published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef _UAPI_LINUX_UUID_H_ #define _UAPI_LINUX_UUID_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 21 "./include/uapi/linux/uuid.h" # 1 "./include/linux/types.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_TYPES_H #define _LINUX_TYPES_H #define __EXPORTED_HEADERS__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./include/linux/types.h" # 1 "./include/uapi/linux/types.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UAPI_LINUX_TYPES_H #define _UAPI_LINUX_TYPES_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/uapi/linux/types.h" # 1 "./arch/x86/include/uapi/asm/types.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_TYPES_H #define _ASM_X86_TYPES_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./arch/x86/include/uapi/asm/types.h" # 1 "./include/uapi/asm-generic/types.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_TYPES_H #define _ASM_GENERIC_TYPES_H /* * int-ll64 is used everywhere now. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 7 "./include/uapi/asm-generic/types.h" # 1 "./include/asm-generic/int-ll64.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ /* * asm-generic/int-ll64.h * * Integer declarations for architectures which use "long long" * for 64-bit types. */ #ifndef _ASM_GENERIC_INT_LL64_H #define _ASM_GENERIC_INT_LL64_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 11 "./include/asm-generic/int-ll64.h" # 1 "./include/uapi/asm-generic/int-ll64.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * asm-generic/int-ll64.h * * Integer declarations for architectures which use "long long" * for 64-bit types. */ #ifndef _UAPI_ASM_GENERIC_INT_LL64_H #define _UAPI_ASM_GENERIC_INT_LL64_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 12 "./include/uapi/asm-generic/int-ll64.h" # 1 "./arch/x86/include/uapi/asm/bitsperlong.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_X86_BITSPERLONG_H #define __ASM_X86_BITSPERLONG_H #if defined(__x86_64__) && !defined(__ILP32__) # define __BITS_PER_LONG 64 #else # 8 "./arch/x86/include/uapi/asm/bitsperlong.h" # define __BITS_PER_LONG 32 #endif # 10 "./arch/x86/include/uapi/asm/bitsperlong.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 11 "./arch/x86/include/uapi/asm/bitsperlong.h" # 1 "./include/asm-generic/bitsperlong.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __ASM_GENERIC_BITS_PER_LONG #define __ASM_GENERIC_BITS_PER_LONG #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/asm-generic/bitsperlong.h" # 1 "./include/uapi/asm-generic/bitsperlong.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UAPI__ASM_GENERIC_BITS_PER_LONG #define _UAPI__ASM_GENERIC_BITS_PER_LONG /* * There seems to be no way of detecting this automatically from user * space, so 64 bit architectures should override this in their * bitsperlong.h. In particular, an architecture that supports * both 32 and 64 bit user space must not rely on CONFIG_64BIT * to decide it, but rather check a compiler provided macro. */ #ifndef __BITS_PER_LONG #define __BITS_PER_LONG 32 #endif # 15 "./include/uapi/asm-generic/bitsperlong.h" #endif /* _UAPI__ASM_GENERIC_BITS_PER_LONG */ # 17 "./include/uapi/asm-generic/bitsperlong.h" # 6 "./include/asm-generic/bitsperlong.h" 2 #ifdef CONFIG_64BIT #define BITS_PER_LONG 64 #else # 11 "./include/asm-generic/bitsperlong.h" #define BITS_PER_LONG 32 #endif /* CONFIG_64BIT */ # 13 "./include/asm-generic/bitsperlong.h" /* * FIXME: The check currently breaks x86-64 build, so it's * temporarily disabled. Please fix x86-64 and reenable */ #if 0 && BITS_PER_LONG != __BITS_PER_LONG #error Inconsistent word size. Check asm/bitsperlong.h #endif # 21 "./include/asm-generic/bitsperlong.h" #ifndef BITS_PER_LONG_LONG #define BITS_PER_LONG_LONG 64 #endif # 25 "./include/asm-generic/bitsperlong.h" #endif /* __ASM_GENERIC_BITS_PER_LONG */ # 27 "./include/asm-generic/bitsperlong.h" # 12 "./arch/x86/include/uapi/asm/bitsperlong.h" 2 #endif /* __ASM_X86_BITSPERLONG_H */ # 14 "./arch/x86/include/uapi/asm/bitsperlong.h" # 13 "./include/uapi/asm-generic/int-ll64.h" 2 #ifndef __ASSEMBLY__ /* * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the * header files exported to user space */ typedef __signed__ char __s8; typedef unsigned char __u8; typedef __signed__ short __s16; typedef unsigned short __u16; typedef __signed__ int __s32; typedef unsigned int __u32; #ifdef __GNUC__ __extension__ typedef __signed__ long long __s64; __extension__ typedef unsigned long long __u64; #else # 33 "./include/uapi/asm-generic/int-ll64.h" typedef __signed__ long long __s64; typedef unsigned long long __u64; #endif # 36 "./include/uapi/asm-generic/int-ll64.h" #endif /* __ASSEMBLY__ */ # 38 "./include/uapi/asm-generic/int-ll64.h" #endif /* _UAPI_ASM_GENERIC_INT_LL64_H */ # 41 "./include/uapi/asm-generic/int-ll64.h" # 12 "./include/asm-generic/int-ll64.h" 2 #ifndef __ASSEMBLY__ typedef signed char s8; typedef unsigned char u8; typedef signed short s16; typedef unsigned short u16; typedef signed int s32; typedef unsigned int u32; typedef signed long long s64; typedef unsigned long long u64; #define S8_C(x) x #define U8_C(x) x ## U #define S16_C(x) x #define U16_C(x) x ## U #define S32_C(x) x #define U32_C(x) x ## U #define S64_C(x) x ## LL #define U64_C(x) x ## ULL #else /* __ASSEMBLY__ */ # 38 "./include/asm-generic/int-ll64.h" #define S8_C(x) x #define U8_C(x) x #define S16_C(x) x #define U16_C(x) x #define S32_C(x) x #define U32_C(x) x #define S64_C(x) x #define U64_C(x) x #endif /* __ASSEMBLY__ */ # 49 "./include/asm-generic/int-ll64.h" #endif /* _ASM_GENERIC_INT_LL64_H */ # 51 "./include/asm-generic/int-ll64.h" # 8 "./include/uapi/asm-generic/types.h" 2 #endif /* _ASM_GENERIC_TYPES_H */ # 10 "./include/uapi/asm-generic/types.h" # 6 "./arch/x86/include/uapi/asm/types.h" 2 #endif /* _ASM_X86_TYPES_H */ # 8 "./arch/x86/include/uapi/asm/types.h" # 6 "./include/uapi/linux/types.h" 2 #ifndef __ASSEMBLY__ #ifndef __KERNEL__ #ifndef __EXPORTED_HEADERS__ #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders" #endif /* __EXPORTED_HEADERS__ */ # 12 "./include/uapi/linux/types.h" #endif # 13 "./include/uapi/linux/types.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 14 "./include/uapi/linux/types.h" # 1 "./include/uapi/linux/posix_types.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_POSIX_TYPES_H #define _LINUX_POSIX_TYPES_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/uapi/linux/posix_types.h" # 1 "./include/linux/stddef.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_STDDEF_H #define _LINUX_STDDEF_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/linux/stddef.h" # 1 "./include/uapi/linux/stddef.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 2 "./include/uapi/linux/stddef.h" # 1 "./include/linux/compiler_types.h" 1 #ifndef __LINUX_COMPILER_TYPES_H #define __LINUX_COMPILER_TYPES_H #ifndef __ASSEMBLY__ #ifdef __CHECKER__ # define __user __attribute__((noderef, address_space(1))) # define __kernel __attribute__((address_space(0))) # define __safe __attribute__((safe)) # define __force __attribute__((force)) # define __nocast __attribute__((nocast)) # define __iomem __attribute__((noderef, address_space(2))) # define __must_hold(x) __attribute__((context(x,1,1))) # define __acquires(x) __attribute__((context(x,0,1))) # define __releases(x) __attribute__((context(x,1,0))) # define __acquire(x) __context__(x,1) # define __release(x) __context__(x,-1) # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) # define __percpu __attribute__((noderef, address_space(3))) # define __rcu __attribute__((noderef, address_space(4))) # define __private __attribute__((noderef)) extern void __chk_user_ptr(const volatile void __user *); extern void __chk_io_ptr(const volatile void __iomem *); # define ACCESS_PRIVATE(p, member) (*((typeof((p)->member) __force *) &(p)->member)) #else /* __CHECKER__ */ # 26 "./include/linux/compiler_types.h" # ifdef STRUCTLEAK_PLUGIN # define __user __attribute__((user)) # else # 29 "./include/linux/compiler_types.h" # define __user # endif # 31 "./include/linux/compiler_types.h" # define __kernel # define __safe # define __force # define __nocast # define __iomem # define __chk_user_ptr(x) (void)0 # define __chk_io_ptr(x) (void)0 # define __builtin_warning(x, y...) (1) # define __must_hold(x) # define __acquires(x) # define __releases(x) # define __acquire(x) (void)0 # define __release(x) (void)0 # define __cond_lock(x,c) (c) # define __percpu # define __rcu # define __private # define ACCESS_PRIVATE(p, member) ((p)->member) #endif /* __CHECKER__ */ # 50 "./include/linux/compiler_types.h" /* Indirect macros required for expanded argument pasting, eg. __LINE__. */ #define ___PASTE(a,b) a##b #define __PASTE(a,b) ___PASTE(a,b) #ifdef __KERNEL__ #ifdef __GNUC__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 58 "./include/linux/compiler_types.h" # 1 "./include/linux/compiler-gcc.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __LINUX_COMPILER_TYPES_H #error "Please don't include directly, include instead." #endif # 5 "./include/linux/compiler-gcc.h" /* * Common definitions for all gcc versions go here. */ #define GCC_VERSION (__GNUC__ * 10000 \ + __GNUC_MINOR__ * 100 \ + __GNUC_PATCHLEVEL__) /* Optimization barrier */ /* The "volatile" is due to gcc bugs */ #define barrier() __asm__ __volatile__("": : :"memory") /* * This version is i.e. to prevent dead stores elimination on @ptr * where gcc and llvm may behave differently when otherwise using * normal barrier(): while gcc behavior gets along with a normal * barrier(), llvm needs an explicit input variable to be assumed * clobbered. The issue is as follows: while the inline asm might * access any memory it wants, the compiler could have fit all of * @ptr into memory registers instead, and since @ptr never escaped * from that, it proved that the inline asm wasn't touching any of * it. This version works well with both compilers, i.e. we're telling * the compiler that the inline asm absolutely may see the contents * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495 */ #define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory") /* * This macro obfuscates arithmetic on a variable address so that gcc * shouldn't recognize the original var, and make assumptions about it. * * This is needed because the C standard makes it undefined to do * pointer arithmetic on "objects" outside their boundaries and the * gcc optimizers assume this is the case. In particular they * assume such arithmetic does not wrap. * * A miscompilation has been observed because of this on PPC. * To work around it we hide the relationship of the pointer and the object * using this macro. * * Versions of the ppc64 compiler before 4.1 had a bug where use of * RELOC_HIDE could trash r30. The bug can be worked around by changing * the inline assembly constraint from =g to =r, in this particular * case either is valid. */ #define RELOC_HIDE(ptr, off) \ ({ \ unsigned long __ptr; \ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ (typeof(ptr)) (__ptr + (off)); \ }) /* Make the optimizer believe the variable can be manipulated arbitrarily. */ #define OPTIMIZER_HIDE_VAR(var) \ __asm__ ("" : "=r" (var) : "0" (var)) #ifdef __CHECKER__ #define __must_be_array(a) 0 #else # 64 "./include/linux/compiler-gcc.h" /* &a[0] degrades to a pointer: a different type from an array */ #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) #endif # 67 "./include/linux/compiler-gcc.h" /* * Force always-inline if the user requests it so via the .config, * or if gcc is too old. * GCC does not warn about unused static inline functions for * -Wunused-function. This turns out to avoid the need for complex #ifdef * directives. Suppress the warning in clang as well by using "unused" * function attribute, which is redundant but not harmful for gcc. */ #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) #define inline inline __attribute__((always_inline,unused)) notrace #define __inline__ __inline__ __attribute__((always_inline,unused)) notrace #define __inline __inline __attribute__((always_inline,unused)) notrace #else # 82 "./include/linux/compiler-gcc.h" /* A lot of inline functions can cause havoc with function tracing */ #define inline inline __attribute__((unused)) notrace #define __inline__ __inline__ __attribute__((unused)) notrace #define __inline __inline __attribute__((unused)) notrace #endif # 87 "./include/linux/compiler-gcc.h" #define __always_inline inline __attribute__((always_inline)) #define noinline __attribute__((noinline)) #define __deprecated __attribute__((deprecated)) #define __packed __attribute__((packed)) #define __weak __attribute__((weak)) #define __alias(symbol) __attribute__((alias(#symbol))) #ifdef RETPOLINE #define __noretpoline __attribute__((indirect_branch("keep"))) #endif # 99 "./include/linux/compiler-gcc.h" /* * it doesn't make sense on ARM (currently the only user of __naked) * to trace naked functions because then mcount is called without * stack and frame pointer being set up and there is no chance to * restore the lr register to the value before mcount was called. * * The asm() bodies of naked functions often depend on standard calling * conventions, therefore they must be noinline and noclone. * * GCC 4.[56] currently fail to enforce this, so we must do so ourselves. * See GCC PR44290. */ #define __naked __attribute__((naked)) noinline __noclone notrace #define __noreturn __attribute__((noreturn)) /* * From the GCC manual: * * Many functions have no effects except the return value and their * return value depends only on the parameters and/or global * variables. Such a function can be subject to common subexpression * elimination and loop optimization just as an arithmetic operator * would be. * [...] */ #define __pure __attribute__((pure)) #define __aligned(x) __attribute__((aligned(x))) #define __aligned_largest __attribute__((aligned)) #define __printf(a, b) __attribute__((format(printf, a, b))) #define __scanf(a, b) __attribute__((format(scanf, a, b))) #define __attribute_const__ __attribute__((__const__)) #define __maybe_unused __attribute__((unused)) #define __always_unused __attribute__((unused)) #define __mode(x) __attribute__((mode(x))) /* gcc version specific checks */ #if GCC_VERSION < 30200 # error Sorry, your compiler is too old - please upgrade it. #endif # 141 "./include/linux/compiler-gcc.h" #if GCC_VERSION < 30300 # define __used __attribute__((__unused__)) #else # 145 "./include/linux/compiler-gcc.h" # define __used __attribute__((__used__)) #endif # 147 "./include/linux/compiler-gcc.h" #ifdef CONFIG_GCOV_KERNEL # if GCC_VERSION < 30400 # error "GCOV profiling support for gcc versions below 3.4 not included" # endif /* __GNUC_MINOR__ */ # 152 "./include/linux/compiler-gcc.h" #endif /* CONFIG_GCOV_KERNEL */ # 153 "./include/linux/compiler-gcc.h" #if GCC_VERSION >= 30400 #define __must_check __attribute__((warn_unused_result)) #define __malloc __attribute__((__malloc__)) #endif # 158 "./include/linux/compiler-gcc.h" #if GCC_VERSION >= 40000 /* GCC 4.1.[01] miscompiles __weak */ #ifdef __KERNEL__ # if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 # error Your version of gcc miscompiles the __weak directive # endif # 166 "./include/linux/compiler-gcc.h" #endif # 167 "./include/linux/compiler-gcc.h" #define __used __attribute__((__used__)) #define __compiler_offsetof(a, b) \ __builtin_offsetof(a, b) #if GCC_VERSION >= 40100 # define __compiletime_object_size(obj) __builtin_object_size(obj, 0) #define __nostackprotector __attribute__((__optimize__("no-stack-protector"))) #endif # 177 "./include/linux/compiler-gcc.h" #if GCC_VERSION >= 40300 /* Mark functions as cold. gcc will assume any path leading to a call * to them will be unlikely. This means a lot of manual unlikely()s * are unnecessary now for any paths leading to the usual suspects * like BUG(), printk(), panic() etc. [but let's keep them for now for * older compilers] * * Early snapshots of gcc 4.3 don't support this and we can't detect this * in the preprocessor, but we can live with this because they're unreleased. * Maketime probing would be overkill here. * * gcc also has a __attribute__((__hot__)) to move hot functions into * a special section, but I don't see any sense in this right now in * the kernel context */ #define __cold __attribute__((__cold__)) #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) #ifndef __CHECKER__ # define __compiletime_warning(message) __attribute__((warning(message))) # define __compiletime_error(message) __attribute__((error(message))) #endif /* __CHECKER__ */ # 201 "./include/linux/compiler-gcc.h" #endif /* GCC_VERSION >= 40300 */ # 202 "./include/linux/compiler-gcc.h" #if GCC_VERSION >= 40500 #ifndef __CHECKER__ #ifdef LATENT_ENTROPY_PLUGIN #define __latent_entropy __attribute__((latent_entropy)) #endif # 209 "./include/linux/compiler-gcc.h" #endif # 210 "./include/linux/compiler-gcc.h" /* * Mark a position in code as unreachable. This can be used to * suppress control flow warnings after asm blocks that transfer * control elsewhere. * * Early snapshots of gcc 4.5 don't support this and we can't detect * this in the preprocessor, but we can live with this because they're * unreleased. Really, we need to have autoconf for the kernel. */ #define unreachable() \ do { annotate_unreachable(); __builtin_unreachable(); } while (0) /* Mark a function definition as prohibited from being cloned. */ #define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) #if defined(RANDSTRUCT_PLUGIN) && !defined(__CHECKER__) #define __randomize_layout __attribute__((randomize_layout)) #define __no_randomize_layout __attribute__((no_randomize_layout)) #endif # 230 "./include/linux/compiler-gcc.h" #endif /* GCC_VERSION >= 40500 */ # 232 "./include/linux/compiler-gcc.h" #if GCC_VERSION >= 40600 /* * When used with Link Time Optimization, gcc can optimize away C functions or * variables which are referenced only from assembly code. __visible tells the * optimizer that something else uses this function or variable, thus preventing * this. */ #define __visible __attribute__((externally_visible)) /* * RANDSTRUCT_PLUGIN wants to use an anonymous struct, but it is only * possible since GCC 4.6. To provide as much build testing coverage * as possible, this is used for all GCC 4.6+ builds, and not just on * RANDSTRUCT_PLUGIN builds. */ #define randomized_struct_fields_start struct { #define randomized_struct_fields_end } __randomize_layout; #endif /* GCC_VERSION >= 40600 */ # 253 "./include/linux/compiler-gcc.h" #if GCC_VERSION >= 40900 && !defined(__CHECKER__) /* * __assume_aligned(n, k): Tell the optimizer that the returned * pointer can be assumed to be k modulo n. The second argument is * optional (default 0), so we use a variadic macro to make the * shorthand. * * Beware: Do not apply this to functions which may return * ERR_PTRs. Also, it is probably unwise to apply it to functions * returning extra information in the low bits (but in that case the * compiler should see some alignment anyway, when the return value is * massaged by 'flags = ptr & 3; ptr &= ~3;'). */ #define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__))) #endif # 270 "./include/linux/compiler-gcc.h" /* * GCC 'asm goto' miscompiles certain code sequences: * * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 * * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. * * (asm goto is automatically volatile - the naming reflects this.) */ #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) /* * sparse (__CHECKER__) pretends to be gcc, but can't do constant * folding in __builtin_bswap*() (yet), so don't set these for it. */ #if defined(CONFIG_ARCH_USE_BUILTIN_BSWAP) && !defined(__CHECKER__) #if GCC_VERSION >= 40400 #define __HAVE_BUILTIN_BSWAP32__ #define __HAVE_BUILTIN_BSWAP64__ #endif # 291 "./include/linux/compiler-gcc.h" #if GCC_VERSION >= 40800 #define __HAVE_BUILTIN_BSWAP16__ #endif # 294 "./include/linux/compiler-gcc.h" #endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP && !__CHECKER__ */ # 295 "./include/linux/compiler-gcc.h" #if GCC_VERSION >= 70000 #define KASAN_ABI_VERSION 5 #elif GCC_VERSION >= 50000 # 299 "./include/linux/compiler-gcc.h" #define KASAN_ABI_VERSION 4 #elif GCC_VERSION >= 40902 # 301 "./include/linux/compiler-gcc.h" #define KASAN_ABI_VERSION 3 #endif # 303 "./include/linux/compiler-gcc.h" #if GCC_VERSION >= 40902 /* * Tell the compiler that address safety instrumentation (KASAN) * should not be applied to that function. * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 */ #define __no_sanitize_address __attribute__((no_sanitize_address)) #endif # 312 "./include/linux/compiler-gcc.h" #if GCC_VERSION >= 50100 /* * Mark structures as requiring designated initializers. * https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html */ #define __designated_init __attribute__((designated_init)) #endif # 320 "./include/linux/compiler-gcc.h" #endif /* gcc version >= 40000 specific checks */ # 322 "./include/linux/compiler-gcc.h" #if !defined(__noclone) #define __noclone /* not needed */ #endif # 326 "./include/linux/compiler-gcc.h" #if !defined(__no_sanitize_address) #define __no_sanitize_address #endif # 330 "./include/linux/compiler-gcc.h" /* * A trick to suppress uninitialized variable warning without generating any * code */ #define uninitialized_var(x) x = x # 59 "./include/linux/compiler_types.h" 2 #endif # 60 "./include/linux/compiler_types.h" #if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__) #define notrace __attribute__((hotpatch(0,0))) #else # 64 "./include/linux/compiler_types.h" #define notrace __attribute__((no_instrument_function)) #endif # 66 "./include/linux/compiler_types.h" /* Intel compiler defines __GNUC__. So we will overwrite implementations * coming from above header files here */ #ifdef __INTEL_COMPILER #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 71 "./include/linux/compiler_types.h" # 72 "./include/linux/compiler_types.h" #endif # 73 "./include/linux/compiler_types.h" /* Clang compiler defines __GNUC__. So we will overwrite implementations * coming from above header files here */ #ifdef __clang__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 78 "./include/linux/compiler_types.h" # 1 "./include/linux/compiler-clang.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __LINUX_COMPILER_TYPES_H #error "Please don't include directly, include instead." #endif # 5 "./include/linux/compiler-clang.h" /* Some compiler specific definitions are overwritten here * for Clang compiler */ #ifdef uninitialized_var #undef uninitialized_var #define uninitialized_var(x) x = *(&(x)) #endif # 14 "./include/linux/compiler-clang.h" /* same as gcc, this was present in clang-2.6 so we can assume it works * with any version that can compile the kernel */ #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) #define randomized_struct_fields_start struct { #define randomized_struct_fields_end }; /* Clang doesn't have a way to turn it off per-function, yet. */ #ifdef __noretpoline #undef __noretpoline #endif # 27 "./include/linux/compiler-clang.h" # 79 "./include/linux/compiler_types.h" 2 #endif # 80 "./include/linux/compiler_types.h" /* * Generic compiler-dependent macros required for kernel * build go below this comment. Actual compiler/compiler version * specific implementations come from the above header files */ struct ftrace_branch_data { const char *func; const char *file; unsigned line; union { struct { unsigned long correct; unsigned long incorrect; }; struct { unsigned long miss; unsigned long hit; }; unsigned long miss_hit[2]; }; }; struct ftrace_likely_data { struct ftrace_branch_data data; unsigned long constant; }; #endif /* __KERNEL__ */ # 110 "./include/linux/compiler_types.h" #endif /* __ASSEMBLY__ */ # 112 "./include/linux/compiler_types.h" #ifdef __KERNEL__ /* * Allow us to mark functions as 'deprecated' and have gcc emit a nice * warning for each use, in hopes of speeding the functions removal. * Usage is: * int __deprecated foo(void) */ #ifndef __deprecated # define __deprecated /* unimplemented */ #endif # 123 "./include/linux/compiler_types.h" #ifdef MODULE #define __deprecated_for_modules __deprecated #else # 127 "./include/linux/compiler_types.h" #define __deprecated_for_modules #endif # 129 "./include/linux/compiler_types.h" #ifndef __must_check #define __must_check #endif # 133 "./include/linux/compiler_types.h" #ifndef CONFIG_ENABLE_MUST_CHECK #undef __must_check #define __must_check #endif # 138 "./include/linux/compiler_types.h" #ifndef CONFIG_ENABLE_WARN_DEPRECATED #undef __deprecated #undef __deprecated_for_modules #define __deprecated #define __deprecated_for_modules #endif # 144 "./include/linux/compiler_types.h" #ifndef __malloc #define __malloc #endif # 148 "./include/linux/compiler_types.h" /* * Allow us to avoid 'defined but not used' warnings on functions and data, * as well as force them to be emitted to the assembly file. * * As of gcc 3.4, static functions that are not marked with attribute((used)) * may be elided from the assembly file. As of gcc 3.4, static data not so * marked will not be elided, but this may change in a future gcc version. * * NOTE: Because distributions shipped with a backported unit-at-a-time * compiler in gcc 3.3, we must define __used to be __attribute__((used)) * for gcc >=3.3 instead of 3.4. * * In prior versions of gcc, such functions and data would be emitted, but * would be warned about except with attribute((unused)). * * Mark functions that are referenced only in inline assembly as __used so * the code is emitted even though it appears to be unreferenced. */ #ifndef __used # define __used /* unimplemented */ #endif # 170 "./include/linux/compiler_types.h" #ifndef __maybe_unused # define __maybe_unused /* unimplemented */ #endif # 174 "./include/linux/compiler_types.h" #ifndef __always_unused # define __always_unused /* unimplemented */ #endif # 178 "./include/linux/compiler_types.h" #ifndef noinline #define noinline #endif # 182 "./include/linux/compiler_types.h" /* * Rather then using noinline to prevent stack consumption, use * noinline_for_stack instead. For documentation reasons. */ #define noinline_for_stack noinline #ifndef __always_inline #define __always_inline inline #endif # 192 "./include/linux/compiler_types.h" #endif /* __KERNEL__ */ # 194 "./include/linux/compiler_types.h" /* * From the GCC manual: * * Many functions do not examine any values except their arguments, * and have no effects except the return value. Basically this is * just slightly more strict class than the `pure' attribute above, * since function is not allowed to read global memory. * * Note that a function that has pointer arguments and examines the * data pointed to must _not_ be declared `const'. Likewise, a * function that calls a non-`const' function usually must not be * `const'. It does not make sense for a `const' function to return * `void'. */ #ifndef __attribute_const__ # define __attribute_const__ /* unimplemented */ #endif # 212 "./include/linux/compiler_types.h" #ifndef __designated_init # define __designated_init #endif # 216 "./include/linux/compiler_types.h" #ifndef __latent_entropy # define __latent_entropy #endif # 220 "./include/linux/compiler_types.h" #ifndef __randomize_layout # define __randomize_layout __designated_init #endif # 224 "./include/linux/compiler_types.h" #ifndef __no_randomize_layout # define __no_randomize_layout #endif # 228 "./include/linux/compiler_types.h" #ifndef randomized_struct_fields_start # define randomized_struct_fields_start # define randomized_struct_fields_end #endif # 233 "./include/linux/compiler_types.h" /* * Tell gcc if a function is cold. The compiler will assume any path * directly leading to the call is unlikely. */ #ifndef __cold #define __cold #endif # 242 "./include/linux/compiler_types.h" /* Simple shorthand for a section definition */ #ifndef __section # define __section(S) __attribute__ ((__section__(#S))) #endif # 247 "./include/linux/compiler_types.h" #ifndef __visible #define __visible #endif # 251 "./include/linux/compiler_types.h" #ifndef __nostackprotector # define __nostackprotector #endif # 255 "./include/linux/compiler_types.h" /* * Assume alignment of return value. */ #ifndef __assume_aligned #define __assume_aligned(a, ...) #endif # 262 "./include/linux/compiler_types.h" /* Are two types/vars the same type (ignoring qualifiers)? */ #ifndef __same_type # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) #endif # 268 "./include/linux/compiler_types.h" /* Is this type a native word size -- useful for atomic operations */ #ifndef __native_word # define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) #endif # 273 "./include/linux/compiler_types.h" #endif /* __LINUX_COMPILER_TYPES_H */ # 275 "./include/linux/compiler_types.h" # 3 "./include/uapi/linux/stddef.h" 2 #ifndef __always_inline #define __always_inline inline #endif # 7 "./include/uapi/linux/stddef.h" # 6 "./include/linux/stddef.h" 2 #undef NULL #define NULL ((void *)0) enum { false = 0, true = 1 }; #undef offsetof #ifdef __compiler_offsetof #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER) #else # 19 "./include/linux/stddef.h" #define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER) #endif # 21 "./include/linux/stddef.h" /** * offsetofend(TYPE, MEMBER) * * @TYPE: The type of the structure * @MEMBER: The member within the structure to get the end offset of */ #define offsetofend(TYPE, MEMBER) \ (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER)) #endif # 32 "./include/linux/stddef.h" # 6 "./include/uapi/linux/posix_types.h" 2 /* * This allows for 1024 file descriptors: if NR_OPEN is ever grown * beyond that you'll have to change this too. But 1024 fd's seem to be * enough even for such "real" unices like OSF/1, so hopefully this is * one limit that doesn't have to be changed [again]. * * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in * (and thus ) - but this is a more logical * place for them. Solved by having dummy defines in . */ /* * This macro may have been defined in . But we always * use the one here. */ #undef __FD_SETSIZE #define __FD_SETSIZE 1024 typedef struct { unsigned long fds_bits[__FD_SETSIZE / (8 * sizeof(long))]; } __kernel_fd_set; /* Type of a signal handler. */ typedef void (*__kernel_sighandler_t)(int); /* Type of a SYSV IPC key. */ typedef int __kernel_key_t; typedef int __kernel_mqd_t; #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "./include/uapi/linux/posix_types.h" # 1 "./arch/x86/include/asm/posix_types.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ # ifdef CONFIG_X86_32 #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 3 "./arch/x86/include/asm/posix_types.h" # 1 "./arch/x86/include/uapi/asm/posix_types_32.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_POSIX_TYPES_32_H #define _ASM_X86_POSIX_TYPES_32_H /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot * assume GCC is being used. */ typedef unsigned short __kernel_mode_t; #define __kernel_mode_t __kernel_mode_t typedef unsigned short __kernel_ipc_pid_t; #define __kernel_ipc_pid_t __kernel_ipc_pid_t typedef unsigned short __kernel_uid_t; typedef unsigned short __kernel_gid_t; #define __kernel_uid_t __kernel_uid_t typedef unsigned short __kernel_old_dev_t; #define __kernel_old_dev_t __kernel_old_dev_t #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 24 "./arch/x86/include/uapi/asm/posix_types_32.h" # 1 "./include/uapi/asm-generic/posix_types.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __ASM_GENERIC_POSIX_TYPES_H #define __ASM_GENERIC_POSIX_TYPES_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/uapi/asm-generic/posix_types.h" # 6 "./include/uapi/asm-generic/posix_types.h" /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. * * First the types that are often defined in different ways across * architectures, so that you can override them. */ #ifndef __kernel_long_t typedef long __kernel_long_t; typedef unsigned long __kernel_ulong_t; #endif # 18 "./include/uapi/asm-generic/posix_types.h" #ifndef __kernel_ino_t typedef __kernel_ulong_t __kernel_ino_t; #endif # 22 "./include/uapi/asm-generic/posix_types.h" #ifndef __kernel_mode_t typedef unsigned int __kernel_mode_t; #endif # 26 "./include/uapi/asm-generic/posix_types.h" #ifndef __kernel_pid_t typedef int __kernel_pid_t; #endif # 30 "./include/uapi/asm-generic/posix_types.h" #ifndef __kernel_ipc_pid_t typedef int __kernel_ipc_pid_t; #endif # 34 "./include/uapi/asm-generic/posix_types.h" #ifndef __kernel_uid_t typedef unsigned int __kernel_uid_t; typedef unsigned int __kernel_gid_t; #endif # 39 "./include/uapi/asm-generic/posix_types.h" #ifndef __kernel_suseconds_t typedef __kernel_long_t __kernel_suseconds_t; #endif # 43 "./include/uapi/asm-generic/posix_types.h" #ifndef __kernel_daddr_t typedef int __kernel_daddr_t; #endif # 47 "./include/uapi/asm-generic/posix_types.h" #ifndef __kernel_uid32_t typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; #endif # 52 "./include/uapi/asm-generic/posix_types.h" #ifndef __kernel_old_uid_t typedef __kernel_uid_t __kernel_old_uid_t; typedef __kernel_gid_t __kernel_old_gid_t; #endif # 57 "./include/uapi/asm-generic/posix_types.h" #ifndef __kernel_old_dev_t typedef unsigned int __kernel_old_dev_t; #endif # 61 "./include/uapi/asm-generic/posix_types.h" /* * Most 32 bit architectures use "unsigned int" size_t, * and all 64 bit architectures use "unsigned long" size_t. */ #ifndef __kernel_size_t #if __BITS_PER_LONG != 64 typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; #else # 72 "./include/uapi/asm-generic/posix_types.h" typedef __kernel_ulong_t __kernel_size_t; typedef __kernel_long_t __kernel_ssize_t; typedef __kernel_long_t __kernel_ptrdiff_t; #endif # 76 "./include/uapi/asm-generic/posix_types.h" #endif # 77 "./include/uapi/asm-generic/posix_types.h" #ifndef __kernel_fsid_t typedef struct { int val[2]; } __kernel_fsid_t; #endif # 83 "./include/uapi/asm-generic/posix_types.h" /* * anything below here should be completely generic */ typedef __kernel_long_t __kernel_off_t; typedef long long __kernel_loff_t; typedef __kernel_long_t __kernel_time_t; typedef __kernel_long_t __kernel_clock_t; typedef int __kernel_timer_t; typedef int __kernel_clockid_t; typedef char * __kernel_caddr_t; typedef unsigned short __kernel_uid16_t; typedef unsigned short __kernel_gid16_t; #endif /* __ASM_GENERIC_POSIX_TYPES_H */ # 98 "./include/uapi/asm-generic/posix_types.h" # 25 "./arch/x86/include/uapi/asm/posix_types_32.h" 2 #endif /* _ASM_X86_POSIX_TYPES_32_H */ # 27 "./arch/x86/include/uapi/asm/posix_types_32.h" # 4 "./arch/x86/include/asm/posix_types.h" 2 # else # 5 "./arch/x86/include/asm/posix_types.h" #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 5 "./arch/x86/include/asm/posix_types.h" # 6 "./arch/x86/include/asm/posix_types.h" # endif # 7 "./arch/x86/include/asm/posix_types.h" # 37 "./include/uapi/linux/posix_types.h" 2 #endif /* _LINUX_POSIX_TYPES_H */ # 39 "./include/uapi/linux/posix_types.h" # 15 "./include/uapi/linux/types.h" 2 /* * Below are truly Linux-specific types that should never collide with * any application/library that wants linux/types.h. */ #ifdef __CHECKER__ #define __bitwise__ __attribute__((bitwise)) #else # 25 "./include/uapi/linux/types.h" #define __bitwise__ #endif # 27 "./include/uapi/linux/types.h" #define __bitwise __bitwise__ typedef __u16 __bitwise __le16; typedef __u16 __bitwise __be16; typedef __u32 __bitwise __le32; typedef __u32 __bitwise __be32; typedef __u64 __bitwise __le64; typedef __u64 __bitwise __be64; typedef __u16 __bitwise __sum16; typedef __u32 __bitwise __wsum; /* * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid * common 32/64-bit compat problems. * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other * architectures) and to 8-byte boundaries on 64-bit architectures. The new * aligned_64 type enforces 8-byte alignment so that structs containing * aligned_64 values have the same alignment on 32-bit and 64-bit architectures. * No conversions are necessary between 32-bit user-space and a 64-bit kernel. */ #define __aligned_u64 __u64 __attribute__((aligned(8))) #define __aligned_be64 __be64 __attribute__((aligned(8))) #define __aligned_le64 __le64 __attribute__((aligned(8))) #endif /* __ASSEMBLY__ */ # 53 "./include/uapi/linux/types.h" #endif /* _UAPI_LINUX_TYPES_H */ # 54 "./include/uapi/linux/types.h" # 7 "./include/linux/types.h" 2 #ifndef __ASSEMBLY__ #define DECLARE_BITMAP(name,bits) \ unsigned long name[BITS_TO_LONGS(bits)] typedef __u32 __kernel_dev_t; typedef __kernel_fd_set fd_set; typedef __kernel_dev_t dev_t; typedef __kernel_ino_t ino_t; typedef __kernel_mode_t mode_t; typedef unsigned short umode_t; typedef __u32 nlink_t; typedef __kernel_off_t off_t; typedef __kernel_pid_t pid_t; typedef __kernel_daddr_t daddr_t; typedef __kernel_key_t key_t; typedef __kernel_suseconds_t suseconds_t; typedef __kernel_timer_t timer_t; typedef __kernel_clockid_t clockid_t; typedef __kernel_mqd_t mqd_t; typedef _Bool bool; typedef __kernel_uid32_t uid_t; typedef __kernel_gid32_t gid_t; typedef __kernel_uid16_t uid16_t; typedef __kernel_gid16_t gid16_t; typedef unsigned long uintptr_t; #ifdef CONFIG_HAVE_UID16 /* This is defined by include/asm-{arch}/posix_types.h */ typedef __kernel_old_uid_t old_uid_t; typedef __kernel_old_gid_t old_gid_t; #endif /* CONFIG_UID16 */ # 44 "./include/linux/types.h" #if defined(__GNUC__) typedef __kernel_loff_t loff_t; #endif # 48 "./include/linux/types.h" /* * The following typedefs are also protected by individual ifdefs for * historical reasons: */ #ifndef _SIZE_T #define _SIZE_T typedef __kernel_size_t size_t; #endif # 57 "./include/linux/types.h" #ifndef _SSIZE_T #define _SSIZE_T typedef __kernel_ssize_t ssize_t; #endif # 62 "./include/linux/types.h" #ifndef _PTRDIFF_T #define _PTRDIFF_T typedef __kernel_ptrdiff_t ptrdiff_t; #endif # 67 "./include/linux/types.h" #ifndef _TIME_T #define _TIME_T typedef __kernel_time_t time_t; #endif # 72 "./include/linux/types.h" #ifndef _CLOCK_T #define _CLOCK_T typedef __kernel_clock_t clock_t; #endif # 77 "./include/linux/types.h" #ifndef _CADDR_T #define _CADDR_T typedef __kernel_caddr_t caddr_t; #endif # 82 "./include/linux/types.h" /* bsd */ typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; /* sysv */ typedef unsigned char unchar; typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long ulong; #ifndef __BIT_TYPES_DEFINED__ #define __BIT_TYPES_DEFINED__ typedef __u8 u_int8_t; typedef __s8 int8_t; typedef __u16 u_int16_t; typedef __s16 int16_t; typedef __u32 u_int32_t; typedef __s32 int32_t; #endif /* !(__BIT_TYPES_DEFINED__) */ # 106 "./include/linux/types.h" typedef __u8 uint8_t; typedef __u16 uint16_t; typedef __u32 uint32_t; #if defined(__GNUC__) typedef __u64 uint64_t; typedef __u64 u_int64_t; typedef __s64 int64_t; #endif # 116 "./include/linux/types.h" /* this is a special 64bit data type that is 8-byte aligned */ #define aligned_u64 __u64 __attribute__((aligned(8))) #define aligned_be64 __be64 __attribute__((aligned(8))) #define aligned_le64 __le64 __attribute__((aligned(8))) /** * The type used for indexing onto a disc or disc partition. * * Linux always considers sectors to be 512 bytes long independently * of the devices real block size. * * blkcnt_t is the type of the inode's block count. */ #ifdef CONFIG_LBDAF typedef u64 sector_t; typedef u64 blkcnt_t; #else # 134 "./include/linux/types.h" typedef unsigned long sector_t; typedef unsigned long blkcnt_t; #endif # 137 "./include/linux/types.h" /* * The type of an index into the pagecache. */ #define pgoff_t unsigned long /* * A dma_addr_t can hold any valid DMA address, i.e., any address returned * by the DMA API. * * If the DMA API only uses 32-bit addresses, dma_addr_t need only be 32 * bits wide. Bus addresses, e.g., PCI BARs, may be wider than 32 bits, * but drivers do memory-mapped I/O to ioremapped kernel virtual addresses, * so they don't care about the size of the actual bus addresses. */ #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT typedef u64 dma_addr_t; #else # 155 "./include/linux/types.h" typedef u32 dma_addr_t; #endif # 157 "./include/linux/types.h" typedef unsigned __bitwise gfp_t; typedef unsigned __bitwise slab_flags_t; typedef unsigned __bitwise fmode_t; #ifdef CONFIG_PHYS_ADDR_T_64BIT typedef u64 phys_addr_t; #else # 165 "./include/linux/types.h" typedef u32 phys_addr_t; #endif # 167 "./include/linux/types.h" typedef phys_addr_t resource_size_t; /* * This type is the placeholder for a hardware interrupt number. It has to be * big enough to enclose whatever representation is used by a given platform. */ typedef unsigned long irq_hw_number_t; typedef struct { int counter; } atomic_t; #ifdef CONFIG_64BIT typedef struct { long counter; } atomic64_t; #endif # 185 "./include/linux/types.h" struct list_head { struct list_head *next, *prev; }; struct hlist_head { struct hlist_node *first; }; struct hlist_node { struct hlist_node *next, **pprev; }; struct ustat { __kernel_daddr_t f_tfree; __kernel_ino_t f_tinode; char f_fname[6]; char f_fpack[6]; }; /** * struct callback_head - callback structure for use with RCU and task_work * @next: next update requests in a list * @func: actual update function to call after the grace period. * * The struct is aligned to size of pointer. On most architectures it happens * naturally due ABI requirements, but some architectures (like CRIS) have * weird ABI and we need to ask it explicitly. * * The alignment is required to guarantee that bit 0 of @next will be * clear under normal conditions -- as long as we use call_rcu(), * call_rcu_bh(), call_rcu_sched(), or call_srcu() to queue callback. * * This guarantee is important for few reasons: * - future call_rcu_lazy() will make use of lower bits in the pointer; * - the structure shares storage spacer in struct page with @compound_head, * which encode PageTail() in bit 0. The guarantee is needed to avoid * false-positive PageTail(). */ struct callback_head { struct callback_head *next; void (*func)(struct callback_head *head); } __attribute__((aligned(sizeof(void *)))); #define rcu_head callback_head typedef void (*rcu_callback_t)(struct rcu_head *head); typedef void (*call_rcu_func_t)(struct rcu_head *head, rcu_callback_t func); #endif /* __ASSEMBLY__ */ # 234 "./include/linux/types.h" #endif /* _LINUX_TYPES_H */ # 235 "./include/linux/types.h" # 22 "./include/uapi/linux/uuid.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 22 "./include/uapi/linux/uuid.h" # 1 "./include/linux/string.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_STRING_H_ #define _LINUX_STRING_H_ #if 0 /* expanded by -frewrite-includes */ #include /* for inline */ #endif /* expanded by -frewrite-includes */ # 6 "./include/linux/string.h" # 1 "./include/linux/compiler.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __LINUX_COMPILER_H #define __LINUX_COMPILER_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/linux/compiler.h" # 6 "./include/linux/compiler.h" #ifndef __ASSEMBLY__ #ifdef __KERNEL__ /* * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code * to disable branch tracing on a per file basis. */ #if defined(CONFIG_TRACE_BRANCH_PROFILING) \ && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__) void ftrace_likely_update(struct ftrace_likely_data *f, int val, int expect, int is_constant); #define likely_notrace(x) __builtin_expect(!!(x), 1) #define unlikely_notrace(x) __builtin_expect(!!(x), 0) #define __branch_check__(x, expect, is_constant) ({ \ int ______r; \ static struct ftrace_likely_data \ __attribute__((__aligned__(4))) \ __attribute__((section("_ftrace_annotated_branch"))) \ ______f = { \ .data.func = __func__, \ .data.file = __FILE__, \ .data.line = __LINE__, \ }; \ ______r = __builtin_expect(!!(x), expect); \ ftrace_likely_update(&______f, ______r, \ expect, is_constant); \ ______r; \ }) /* * Using __builtin_constant_p(x) to ignore cases where the return * value is always the same. This idea is taken from a similar patch * written by Daniel Walker. */ # ifndef likely # define likely(x) (__branch_check__(x, 1, __builtin_constant_p(x))) # endif # 47 "./include/linux/compiler.h" # ifndef unlikely # define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x))) # endif # 50 "./include/linux/compiler.h" #ifdef CONFIG_PROFILE_ALL_BRANCHES /* * "Define 'is'", Bill Clinton * "Define 'if'", Steven Rostedt */ #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) #define __trace_if(cond) \ if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ({ \ int ______r; \ static struct ftrace_branch_data \ __attribute__((__aligned__(4))) \ __attribute__((section("_ftrace_branch"))) \ ______f = { \ .func = __func__, \ .file = __FILE__, \ .line = __LINE__, \ }; \ ______r = !!(cond); \ ______f.miss_hit[______r]++; \ ______r; \ })) #endif /* CONFIG_PROFILE_ALL_BRANCHES */ # 74 "./include/linux/compiler.h" #else # 76 "./include/linux/compiler.h" # define likely(x) __builtin_expect(!!(x), 1) # define unlikely(x) __builtin_expect(!!(x), 0) #endif # 79 "./include/linux/compiler.h" /* Optimization barrier */ #ifndef barrier # define barrier() __memory_barrier() #endif # 84 "./include/linux/compiler.h" #ifndef barrier_data # define barrier_data(ptr) barrier() #endif # 88 "./include/linux/compiler.h" /* Unreachable code */ #ifdef CONFIG_STACK_VALIDATION /* * These macros help objtool understand GCC code flow for unreachable code. * The __COUNTER__ based labels are a hack to make each instance of the macros * unique, to convince GCC not to merge duplicate inline asm statements. */ #define annotate_reachable() ({ \ asm volatile("%c0:\n\t" \ ".pushsection .discard.reachable\n\t" \ ".long %c0b - .\n\t" \ ".popsection\n\t" : : "i" (__COUNTER__)); \ }) #define annotate_unreachable() ({ \ asm volatile("%c0:\n\t" \ ".pushsection .discard.unreachable\n\t" \ ".long %c0b - .\n\t" \ ".popsection\n\t" : : "i" (__COUNTER__)); \ }) #define ASM_UNREACHABLE \ "999:\n\t" \ ".pushsection .discard.unreachable\n\t" \ ".long 999b - .\n\t" \ ".popsection\n\t" #else # 114 "./include/linux/compiler.h" #define annotate_reachable() #define annotate_unreachable() #endif # 117 "./include/linux/compiler.h" #ifndef ASM_UNREACHABLE # define ASM_UNREACHABLE #endif # 121 "./include/linux/compiler.h" #ifndef unreachable # define unreachable() do { annotate_reachable(); do { } while (1); } while (0) #endif # 124 "./include/linux/compiler.h" /* * KENTRY - kernel entry point * This can be used to annotate symbols (functions or data) that are used * without their linker symbol being referenced explicitly. For example, * interrupt vector handlers, or functions in the kernel image that are found * programatically. * * Not required for symbols exported with EXPORT_SYMBOL, or initcalls. Those * are handled in their own way (with KEEP() in linker scripts). * * KENTRY can be avoided if the symbols in question are marked as KEEP() in the * linker script. For example an architecture could KEEP() its entire * boot/exception vector code rather than annotate each function and data. */ #ifndef KENTRY # define KENTRY(sym) \ extern typeof(sym) sym; \ static const unsigned long __kentry_##sym \ __used \ __attribute__((section("___kentry" "+" #sym ), used)) \ = (unsigned long)&sym; #endif # 147 "./include/linux/compiler.h" #ifndef RELOC_HIDE # define RELOC_HIDE(ptr, off) \ ({ unsigned long __ptr; \ __ptr = (unsigned long) (ptr); \ (typeof(ptr)) (__ptr + (off)); }) #endif # 154 "./include/linux/compiler.h" #ifndef OPTIMIZER_HIDE_VAR #define OPTIMIZER_HIDE_VAR(var) barrier() #endif # 158 "./include/linux/compiler.h" /* Not-quite-unique ID. */ #ifndef __UNIQUE_ID # define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) #endif # 163 "./include/linux/compiler.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 164 "./include/linux/compiler.h" # 165 "./include/linux/compiler.h" #define __READ_ONCE_SIZE \ ({ \ switch (size) { \ case 1: *(__u8 *)res = *(volatile __u8 *)p; break; \ case 2: *(__u16 *)res = *(volatile __u16 *)p; break; \ case 4: *(__u32 *)res = *(volatile __u32 *)p; break; \ case 8: *(__u64 *)res = *(volatile __u64 *)p; break; \ default: \ barrier(); \ __builtin_memcpy((void *)res, (const void *)p, size); \ barrier(); \ } \ }) static __always_inline void __read_once_size(const volatile void *p, void *res, int size) { __READ_ONCE_SIZE; } #ifdef CONFIG_KASAN /* * This function is not 'inline' because __no_sanitize_address confilcts * with inlining. Attempt to inline it may cause a build failure. * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 * '__maybe_unused' allows us to avoid defined-but-not-used warnings. */ static __no_sanitize_address __maybe_unused void __read_once_size_nocheck(const volatile void *p, void *res, int size) { __READ_ONCE_SIZE; } #else # 199 "./include/linux/compiler.h" static __always_inline void __read_once_size_nocheck(const volatile void *p, void *res, int size) { __READ_ONCE_SIZE; } #endif # 205 "./include/linux/compiler.h" static __always_inline void __write_once_size(volatile void *p, void *res, int size) { switch (size) { case 1: *(volatile __u8 *)p = *(__u8 *)res; break; case 2: *(volatile __u16 *)p = *(__u16 *)res; break; case 4: *(volatile __u32 *)p = *(__u32 *)res; break; case 8: *(volatile __u64 *)p = *(__u64 *)res; break; default: barrier(); __builtin_memcpy((void *)p, (const void *)res, size); barrier(); } } /* * Prevent the compiler from merging or refetching reads or writes. The * compiler is also forbidden from reordering successive instances of * READ_ONCE and WRITE_ONCE, but only when the compiler is aware of some * particular ordering. One way to make the compiler aware of ordering is to * put the two invocations of READ_ONCE or WRITE_ONCE in different C * statements. * * These two macros will also work on aggregate data types like structs or * unions. If the size of the accessed data type exceeds the word size of * the machine (e.g., 32 bits or 64 bits) READ_ONCE() and WRITE_ONCE() will * fall back to memcpy(). There's at least two memcpy()s: one for the * __builtin_memcpy() and then one for the macro doing the copy of variable * - '__u' allocated on the stack. * * Their two major use cases are: (1) Mediating communication between * process-level code and irq/NMI handlers, all running on the same CPU, * and (2) Ensuring that the compiler does not fold, spindle, or otherwise * mutilate accesses that either do not require ordering or that interact * with an explicit memory barrier or atomic instruction that provides the * required ordering. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 242 "./include/linux/compiler.h" # 1 "./arch/x86/include/asm/barrier.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_BARRIER_H #define _ASM_X86_BARRIER_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./arch/x86/include/asm/barrier.h" # 1 "./arch/x86/include/asm/alternative.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_ALTERNATIVE_H #define _ASM_X86_ALTERNATIVE_H #ifndef __ASSEMBLY__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 7 "./arch/x86/include/asm/alternative.h" # 8 "./arch/x86/include/asm/alternative.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 8 "./arch/x86/include/asm/alternative.h" # 9 "./arch/x86/include/asm/alternative.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 9 "./arch/x86/include/asm/alternative.h" # 1 "./include/linux/stringify.h" 1 #ifndef __LINUX_STRINGIFY_H #define __LINUX_STRINGIFY_H /* Indirect stringification. Doing two levels allows the parameter to be a * macro itself. For example, compile with -DFOO=bar, __stringify(FOO) * converts to "bar". */ #define __stringify_1(x...) #x #define __stringify(x...) __stringify_1(x) #endif /* !__LINUX_STRINGIFY_H */ # 13 "./include/linux/stringify.h" # 10 "./arch/x86/include/asm/alternative.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 10 "./arch/x86/include/asm/alternative.h" # 1 "./arch/x86/include/asm/asm.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_ASM_H #define _ASM_X86_ASM_H #ifdef __ASSEMBLY__ # define __ASM_FORM(x) x # define __ASM_FORM_RAW(x) x # define __ASM_FORM_COMMA(x) x, #else # 10 "./arch/x86/include/asm/asm.h" # define __ASM_FORM(x) " " #x " " # define __ASM_FORM_RAW(x) #x # define __ASM_FORM_COMMA(x) " " #x "," #endif # 14 "./arch/x86/include/asm/asm.h" #ifndef __x86_64__ /* 32 bit */ # define __ASM_SEL(a,b) __ASM_FORM(a) # define __ASM_SEL_RAW(a,b) __ASM_FORM_RAW(a) #else # 20 "./arch/x86/include/asm/asm.h" /* 64 bit */ # define __ASM_SEL(a,b) __ASM_FORM(b) # define __ASM_SEL_RAW(a,b) __ASM_FORM_RAW(b) #endif # 24 "./arch/x86/include/asm/asm.h" #define __ASM_SIZE(inst, ...) __ASM_SEL(inst##l##__VA_ARGS__, \ inst##q##__VA_ARGS__) #define __ASM_REG(reg) __ASM_SEL_RAW(e##reg, r##reg) #define _ASM_PTR __ASM_SEL(.long, .quad) #define _ASM_ALIGN __ASM_SEL(.balign 4, .balign 8) #define _ASM_MOV __ASM_SIZE(mov) #define _ASM_INC __ASM_SIZE(inc) #define _ASM_DEC __ASM_SIZE(dec) #define _ASM_ADD __ASM_SIZE(add) #define _ASM_SUB __ASM_SIZE(sub) #define _ASM_XADD __ASM_SIZE(xadd) #define _ASM_MUL __ASM_SIZE(mul) #define _ASM_AX __ASM_REG(ax) #define _ASM_BX __ASM_REG(bx) #define _ASM_CX __ASM_REG(cx) #define _ASM_DX __ASM_REG(dx) #define _ASM_SP __ASM_REG(sp) #define _ASM_BP __ASM_REG(bp) #define _ASM_SI __ASM_REG(si) #define _ASM_DI __ASM_REG(di) /* * Macros to generate condition code outputs from inline assembly, * The output operand must be type "bool". */ #ifdef __GCC_ASM_FLAG_OUTPUTS__ # define CC_SET(c) "\n\t/* output condition code " #c "*/\n" # define CC_OUT(c) "=@cc" #c #else # 57 "./arch/x86/include/asm/asm.h" # define CC_SET(c) "\n\tset" #c " %[_cc_" #c "]\n" # define CC_OUT(c) [_cc_ ## c] "=qm" #endif # 60 "./arch/x86/include/asm/asm.h" /* Exception table entry */ #ifdef __ASSEMBLY__ # define _ASM_EXTABLE_HANDLE(from, to, handler) \ .pushsection "__ex_table","a" ; \ .balign 4 ; \ .long (from) - . ; \ .long (to) - . ; \ .long (handler) - . ; \ .popsection # define _ASM_EXTABLE(from, to) \ _ASM_EXTABLE_HANDLE(from, to, ex_handler_default) # define _ASM_EXTABLE_FAULT(from, to) \ _ASM_EXTABLE_HANDLE(from, to, ex_handler_fault) # define _ASM_EXTABLE_EX(from, to) \ _ASM_EXTABLE_HANDLE(from, to, ex_handler_ext) # define _ASM_EXTABLE_REFCOUNT(from, to) \ _ASM_EXTABLE_HANDLE(from, to, ex_handler_refcount) # define _ASM_NOKPROBE(entry) \ .pushsection "_kprobe_blacklist","aw" ; \ _ASM_ALIGN ; \ _ASM_PTR (entry); \ .popsection .macro ALIGN_DESTINATION /* check for bad alignment of destination */ movl %edi,%ecx andl $7,%ecx jz 102f /* already aligned */ subl $8,%ecx negl %ecx subl %ecx,%edx 100: movb (%rsi),%al 101: movb %al,(%rdi) incq %rsi incq %rdi decl %ecx jnz 100b 102: .section .fixup,"ax" 103: addl %ecx,%edx /* ecx is zerorest also */ jmp copy_user_handle_tail .previous _ASM_EXTABLE(100b,103b) _ASM_EXTABLE(101b,103b) .endm #else # 114 "./arch/x86/include/asm/asm.h" # define _EXPAND_EXTABLE_HANDLE(x) #x # define _ASM_EXTABLE_HANDLE(from, to, handler) \ " .pushsection \"__ex_table\",\"a\"\n" \ " .balign 4\n" \ " .long (" #from ") - .\n" \ " .long (" #to ") - .\n" \ " .long (" _EXPAND_EXTABLE_HANDLE(handler) ") - .\n" \ " .popsection\n" # define _ASM_EXTABLE(from, to) \ _ASM_EXTABLE_HANDLE(from, to, ex_handler_default) # define _ASM_EXTABLE_FAULT(from, to) \ _ASM_EXTABLE_HANDLE(from, to, ex_handler_fault) # define _ASM_EXTABLE_EX(from, to) \ _ASM_EXTABLE_HANDLE(from, to, ex_handler_ext) # define _ASM_EXTABLE_REFCOUNT(from, to) \ _ASM_EXTABLE_HANDLE(from, to, ex_handler_refcount) /* For C file, we already have NOKPROBE_SYMBOL macro */ #endif # 137 "./arch/x86/include/asm/asm.h" #ifndef __ASSEMBLY__ #ifndef __BPF__ /* * This output constraint should be used for any inline asm which has a "call" * instruction. Otherwise the asm may be inserted before the frame pointer * gets set up by the containing function. If you forget to do this, objtool * may print a "call without frame pointer save/setup" warning. */ register unsigned long current_stack_pointer asm(_ASM_SP); #define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer) #endif # 149 "./arch/x86/include/asm/asm.h" #endif # 150 "./arch/x86/include/asm/asm.h" #endif /* _ASM_X86_ASM_H */ # 152 "./arch/x86/include/asm/asm.h" # 11 "./arch/x86/include/asm/alternative.h" 2 /* * Alternative inline assembly for SMP. * * The LOCK_PREFIX macro defined here replaces the LOCK and * LOCK_PREFIX macros used everywhere in the source tree. * * SMP alternatives use the same data structures as the other * alternatives and the X86_FEATURE_UP flag to indicate the case of a * UP system running a SMP kernel. The existing apply_alternatives() * works fine for patching a SMP kernel for UP. * * The SMP alternative tables can be kept after boot and contain both * UP and SMP versions of the instructions to allow switching back to * SMP at runtime, when hotplugging in a new CPU, which is especially * useful in virtualized environments. * * The very common lock prefix is handled as special case in a * separate table which is a pure address list without replacement ptr * and size information. That keeps the table sizes small. */ #ifdef CONFIG_SMP #define LOCK_PREFIX_HERE \ ".pushsection .smp_locks,\"a\"\n" \ ".balign 4\n" \ ".long 671f - .\n" /* offset */ \ ".popsection\n" \ "671:" #define LOCK_PREFIX LOCK_PREFIX_HERE "\n\tlock; " #else /* ! CONFIG_SMP */ # 44 "./arch/x86/include/asm/alternative.h" #define LOCK_PREFIX_HERE "" #define LOCK_PREFIX "" #endif # 47 "./arch/x86/include/asm/alternative.h" struct alt_instr { s32 instr_offset; /* original instruction */ s32 repl_offset; /* offset to replacement instruction */ u16 cpuid; /* cpuid bit set for replacement */ u8 instrlen; /* length of original instruction */ u8 replacementlen; /* length of new instruction */ u8 padlen; /* length of build-time padding */ } __packed; /* * Debug flag that can be tested to see whether alternative * instructions were patched in already: */ extern int alternatives_patched; extern void alternative_instructions(void); extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end); struct module; #ifdef CONFIG_SMP extern void alternatives_smp_module_add(struct module *mod, char *name, void *locks, void *locks_end, void *text, void *text_end); extern void alternatives_smp_module_del(struct module *mod); extern void alternatives_enable_smp(void); extern int alternatives_text_reserved(void *start, void *end); extern bool skip_smp_alternatives; #else # 77 "./arch/x86/include/asm/alternative.h" static inline void alternatives_smp_module_add(struct module *mod, char *name, void *locks, void *locks_end, void *text, void *text_end) {} static inline void alternatives_smp_module_del(struct module *mod) {} static inline void alternatives_enable_smp(void) {} static inline int alternatives_text_reserved(void *start, void *end) { return 0; } #endif /* CONFIG_SMP */ # 87 "./arch/x86/include/asm/alternative.h" #define b_replacement(num) "664"#num #define e_replacement(num) "665"#num #define alt_end_marker "663" #define alt_slen "662b-661b" #define alt_pad_len alt_end_marker"b-662b" #define alt_total_slen alt_end_marker"b-661b" #define alt_rlen(num) e_replacement(num)"f-"b_replacement(num)"f" #define __OLDINSTR(oldinstr, num) \ "661:\n\t" oldinstr "\n662:\n" \ ".skip -(((" alt_rlen(num) ")-(" alt_slen ")) > 0) * " \ "((" alt_rlen(num) ")-(" alt_slen ")),0x90\n" #define OLDINSTR(oldinstr, num) \ __OLDINSTR(oldinstr, num) \ alt_end_marker ":\n" /* * gas compatible max based on the idea from: * http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax * * The additional "-" is needed because gas uses a "true" value of -1. */ #define alt_max_short(a, b) "((" a ") ^ (((" a ") ^ (" b ")) & -(-((" a ") < (" b ")))))" /* * Pad the second replacement alternative with additional NOPs if it is * additionally longer than the first replacement alternative. */ #define OLDINSTR_2(oldinstr, num1, num2) \ "661:\n\t" oldinstr "\n662:\n" \ ".skip -((" alt_max_short(alt_rlen(num1), alt_rlen(num2)) " - (" alt_slen ")) > 0) * " \ "(" alt_max_short(alt_rlen(num1), alt_rlen(num2)) " - (" alt_slen ")), 0x90\n" \ alt_end_marker ":\n" #define ALTINSTR_ENTRY(feature, num) \ " .long 661b - .\n" /* label */ \ " .long " b_replacement(num)"f - .\n" /* new instruction */ \ " .word " __stringify(feature) "\n" /* feature bit */ \ " .byte " alt_total_slen "\n" /* source len */ \ " .byte " alt_rlen(num) "\n" /* replacement len */ \ " .byte " alt_pad_len "\n" /* pad len */ #define ALTINSTR_REPLACEMENT(newinstr, feature, num) /* replacement */ \ b_replacement(num)":\n\t" newinstr "\n" e_replacement(num) ":\n\t" /* alternative assembly primitive: */ #define ALTERNATIVE(oldinstr, newinstr, feature) \ OLDINSTR(oldinstr, 1) \ ".pushsection .altinstructions,\"a\"\n" \ ALTINSTR_ENTRY(feature, 1) \ ".popsection\n" \ ".pushsection .altinstr_replacement, \"ax\"\n" \ ALTINSTR_REPLACEMENT(newinstr, feature, 1) \ ".popsection\n" #define ALTERNATIVE_2(oldinstr, newinstr1, feature1, newinstr2, feature2)\ OLDINSTR_2(oldinstr, 1, 2) \ ".pushsection .altinstructions,\"a\"\n" \ ALTINSTR_ENTRY(feature1, 1) \ ALTINSTR_ENTRY(feature2, 2) \ ".popsection\n" \ ".pushsection .altinstr_replacement, \"ax\"\n" \ ALTINSTR_REPLACEMENT(newinstr1, feature1, 1) \ ALTINSTR_REPLACEMENT(newinstr2, feature2, 2) \ ".popsection\n" /* * Alternative instructions for different CPU types or capabilities. * * This allows to use optimized instructions even on generic binary * kernels. * * length of oldinstr must be longer or equal the length of newinstr * It can be padded with nops as needed. * * For non barrier like inlines please define new variants * without volatile and memory clobber. */ #define alternative(oldinstr, newinstr, feature) \ asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) : : : "memory") #define alternative_2(oldinstr, newinstr1, feature1, newinstr2, feature2) \ asm volatile(ALTERNATIVE_2(oldinstr, newinstr1, feature1, newinstr2, feature2) ::: "memory") /* * Alternative inline assembly with input. * * Pecularities: * No memory clobber here. * Argument numbers start with 1. * Best is to use constraints that are fixed size (like (%1) ... "r") * If you use variable sized constraints like "m" or "g" in the * replacement make sure to pad to the worst case length. * Leaving an unused argument 0 to keep API compatibility. */ #define alternative_input(oldinstr, newinstr, feature, input...) \ asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) \ : : "i" (0), ## input) /* * This is similar to alternative_input. But it has two features and * respective instructions. * * If CPU has feature2, newinstr2 is used. * Otherwise, if CPU has feature1, newinstr1 is used. * Otherwise, oldinstr is used. */ #define alternative_input_2(oldinstr, newinstr1, feature1, newinstr2, \ feature2, input...) \ asm volatile(ALTERNATIVE_2(oldinstr, newinstr1, feature1, \ newinstr2, feature2) \ : : "i" (0), ## input) /* Like alternative_input, but with a single output argument */ #define alternative_io(oldinstr, newinstr, feature, output, input...) \ asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) \ : output : "i" (0), ## input) /* Like alternative_io, but for replacing a direct call with another one. */ #define alternative_call(oldfunc, newfunc, feature, output, input...) \ asm volatile (ALTERNATIVE("call %P[old]", "call %P[new]", feature) \ : output : [old] "i" (oldfunc), [new] "i" (newfunc), ## input) /* * Like alternative_call, but there are two features and respective functions. * If CPU has feature2, function2 is used. * Otherwise, if CPU has feature1, function1 is used. * Otherwise, old function is used. */ #define alternative_call_2(oldfunc, newfunc1, feature1, newfunc2, feature2, \ output, input...) \ { \ asm volatile (ALTERNATIVE_2("call %P[old]", "call %P[new1]", feature1,\ "call %P[new2]", feature2) \ : output, ASM_CALL_CONSTRAINT \ : [old] "i" (oldfunc), [new1] "i" (newfunc1), \ [new2] "i" (newfunc2), ## input); \ } /* * use this macro(s) if you need more than one output parameter * in alternative_io */ #define ASM_OUTPUT2(a...) a /* * use this macro if you need clobbers but no inputs in * alternative_{input,io,call}() */ #define ASM_NO_INPUT_CLOBBER(clbr...) "i" (0) : clbr #endif /* __ASSEMBLY__ */ # 242 "./arch/x86/include/asm/alternative.h" #endif /* _ASM_X86_ALTERNATIVE_H */ # 244 "./arch/x86/include/asm/alternative.h" # 6 "./arch/x86/include/asm/barrier.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./arch/x86/include/asm/barrier.h" # 1 "./arch/x86/include/asm/nops.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_NOPS_H #define _ASM_X86_NOPS_H /* * Define nops for use with alternative() and for tracing. * * *_NOP5_ATOMIC must be a single instruction. */ #define NOP_DS_PREFIX 0x3e /* generic versions from gas 1: nop the following instructions are NOT nops in 64-bit mode, for 64-bit mode use K8 or P6 nops instead 2: movl %esi,%esi 3: leal 0x00(%esi),%esi 4: leal 0x00(,%esi,1),%esi 6: leal 0x00000000(%esi),%esi 7: leal 0x00000000(,%esi,1),%esi */ #define GENERIC_NOP1 0x90 #define GENERIC_NOP2 0x89,0xf6 #define GENERIC_NOP3 0x8d,0x76,0x00 #define GENERIC_NOP4 0x8d,0x74,0x26,0x00 #define GENERIC_NOP5 GENERIC_NOP1,GENERIC_NOP4 #define GENERIC_NOP6 0x8d,0xb6,0x00,0x00,0x00,0x00 #define GENERIC_NOP7 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00 #define GENERIC_NOP8 GENERIC_NOP1,GENERIC_NOP7 #define GENERIC_NOP5_ATOMIC NOP_DS_PREFIX,GENERIC_NOP4 /* Opteron 64bit nops 1: nop 2: osp nop 3: osp osp nop 4: osp osp osp nop */ #define K8_NOP1 GENERIC_NOP1 #define K8_NOP2 0x66,K8_NOP1 #define K8_NOP3 0x66,K8_NOP2 #define K8_NOP4 0x66,K8_NOP3 #define K8_NOP5 K8_NOP3,K8_NOP2 #define K8_NOP6 K8_NOP3,K8_NOP3 #define K8_NOP7 K8_NOP4,K8_NOP3 #define K8_NOP8 K8_NOP4,K8_NOP4 #define K8_NOP5_ATOMIC 0x66,K8_NOP4 /* K7 nops uses eax dependencies (arbitrary choice) 1: nop 2: movl %eax,%eax 3: leal (,%eax,1),%eax 4: leal 0x00(,%eax,1),%eax 6: leal 0x00000000(%eax),%eax 7: leal 0x00000000(,%eax,1),%eax */ #define K7_NOP1 GENERIC_NOP1 #define K7_NOP2 0x8b,0xc0 #define K7_NOP3 0x8d,0x04,0x20 #define K7_NOP4 0x8d,0x44,0x20,0x00 #define K7_NOP5 K7_NOP4,K7_NOP1 #define K7_NOP6 0x8d,0x80,0,0,0,0 #define K7_NOP7 0x8D,0x04,0x05,0,0,0,0 #define K7_NOP8 K7_NOP7,K7_NOP1 #define K7_NOP5_ATOMIC NOP_DS_PREFIX,K7_NOP4 /* P6 nops uses eax dependencies (Intel-recommended choice) 1: nop 2: osp nop 3: nopl (%eax) 4: nopl 0x00(%eax) 5: nopl 0x00(%eax,%eax,1) 6: osp nopl 0x00(%eax,%eax,1) 7: nopl 0x00000000(%eax) 8: nopl 0x00000000(%eax,%eax,1) Note: All the above are assumed to be a single instruction. There is kernel code that depends on this. */ #define P6_NOP1 GENERIC_NOP1 #define P6_NOP2 0x66,0x90 #define P6_NOP3 0x0f,0x1f,0x00 #define P6_NOP4 0x0f,0x1f,0x40,0 #define P6_NOP5 0x0f,0x1f,0x44,0x00,0 #define P6_NOP6 0x66,0x0f,0x1f,0x44,0x00,0 #define P6_NOP7 0x0f,0x1f,0x80,0,0,0,0 #define P6_NOP8 0x0f,0x1f,0x84,0x00,0,0,0,0 #define P6_NOP5_ATOMIC P6_NOP5 #ifdef __ASSEMBLY__ #define _ASM_MK_NOP(x) .byte x #else # 94 "./arch/x86/include/asm/nops.h" #define _ASM_MK_NOP(x) ".byte " __stringify(x) "\n" #endif # 96 "./arch/x86/include/asm/nops.h" #if defined(CONFIG_MK7) #define ASM_NOP1 _ASM_MK_NOP(K7_NOP1) #define ASM_NOP2 _ASM_MK_NOP(K7_NOP2) #define ASM_NOP3 _ASM_MK_NOP(K7_NOP3) #define ASM_NOP4 _ASM_MK_NOP(K7_NOP4) #define ASM_NOP5 _ASM_MK_NOP(K7_NOP5) #define ASM_NOP6 _ASM_MK_NOP(K7_NOP6) #define ASM_NOP7 _ASM_MK_NOP(K7_NOP7) #define ASM_NOP8 _ASM_MK_NOP(K7_NOP8) #define ASM_NOP5_ATOMIC _ASM_MK_NOP(K7_NOP5_ATOMIC) #elif defined(CONFIG_X86_P6_NOP) # 108 "./arch/x86/include/asm/nops.h" #define ASM_NOP1 _ASM_MK_NOP(P6_NOP1) #define ASM_NOP2 _ASM_MK_NOP(P6_NOP2) #define ASM_NOP3 _ASM_MK_NOP(P6_NOP3) #define ASM_NOP4 _ASM_MK_NOP(P6_NOP4) #define ASM_NOP5 _ASM_MK_NOP(P6_NOP5) #define ASM_NOP6 _ASM_MK_NOP(P6_NOP6) #define ASM_NOP7 _ASM_MK_NOP(P6_NOP7) #define ASM_NOP8 _ASM_MK_NOP(P6_NOP8) #define ASM_NOP5_ATOMIC _ASM_MK_NOP(P6_NOP5_ATOMIC) #elif defined(CONFIG_X86_64) # 118 "./arch/x86/include/asm/nops.h" #define ASM_NOP1 _ASM_MK_NOP(K8_NOP1) #define ASM_NOP2 _ASM_MK_NOP(K8_NOP2) #define ASM_NOP3 _ASM_MK_NOP(K8_NOP3) #define ASM_NOP4 _ASM_MK_NOP(K8_NOP4) #define ASM_NOP5 _ASM_MK_NOP(K8_NOP5) #define ASM_NOP6 _ASM_MK_NOP(K8_NOP6) #define ASM_NOP7 _ASM_MK_NOP(K8_NOP7) #define ASM_NOP8 _ASM_MK_NOP(K8_NOP8) #define ASM_NOP5_ATOMIC _ASM_MK_NOP(K8_NOP5_ATOMIC) #else # 128 "./arch/x86/include/asm/nops.h" #define ASM_NOP1 _ASM_MK_NOP(GENERIC_NOP1) #define ASM_NOP2 _ASM_MK_NOP(GENERIC_NOP2) #define ASM_NOP3 _ASM_MK_NOP(GENERIC_NOP3) #define ASM_NOP4 _ASM_MK_NOP(GENERIC_NOP4) #define ASM_NOP5 _ASM_MK_NOP(GENERIC_NOP5) #define ASM_NOP6 _ASM_MK_NOP(GENERIC_NOP6) #define ASM_NOP7 _ASM_MK_NOP(GENERIC_NOP7) #define ASM_NOP8 _ASM_MK_NOP(GENERIC_NOP8) #define ASM_NOP5_ATOMIC _ASM_MK_NOP(GENERIC_NOP5_ATOMIC) #endif # 138 "./arch/x86/include/asm/nops.h" #define ASM_NOP_MAX 8 #define NOP_ATOMIC5 (ASM_NOP_MAX+1) /* Entry for the 5-byte atomic NOP */ #ifndef __ASSEMBLY__ extern const unsigned char * const *ideal_nops; extern void arch_init_ideal_nops(void); #endif # 146 "./arch/x86/include/asm/nops.h" #endif /* _ASM_X86_NOPS_H */ # 148 "./arch/x86/include/asm/nops.h" # 7 "./arch/x86/include/asm/barrier.h" 2 /* * Force strict CPU ordering. * And yes, this might be required on UP too when we're talking * to devices. */ #ifdef CONFIG_X86_32 #define mb() asm volatile(ALTERNATIVE("lock; addl $0,-4(%%esp)", "mfence", \ X86_FEATURE_XMM2) ::: "memory", "cc") #define rmb() asm volatile(ALTERNATIVE("lock; addl $0,-4(%%esp)", "lfence", \ X86_FEATURE_XMM2) ::: "memory", "cc") #define wmb() asm volatile(ALTERNATIVE("lock; addl $0,-4(%%esp)", "sfence", \ X86_FEATURE_XMM2) ::: "memory", "cc") #else # 22 "./arch/x86/include/asm/barrier.h" #define mb() asm volatile("mfence":::"memory") #define rmb() asm volatile("lfence":::"memory") #define wmb() asm volatile("sfence" ::: "memory") #endif # 26 "./arch/x86/include/asm/barrier.h" /** * array_index_mask_nospec() - generate a mask that is ~0UL when the * bounds check succeeds and 0 otherwise * @index: array element index * @size: number of elements in array * * Returns: * 0 - (index < size) */ static inline unsigned long array_index_mask_nospec(unsigned long index, unsigned long size) { unsigned long mask; asm ("cmp %1,%2; sbb %0,%0;" :"=r" (mask) :"g"(size),"r" (index) :"cc"); return mask; } /* Override the default implementation from linux/nospec.h. */ #define array_index_mask_nospec array_index_mask_nospec /* Prevent speculative execution past this barrier. */ #define barrier_nospec() alternative_2("", "mfence", X86_FEATURE_MFENCE_RDTSC, \ "lfence", X86_FEATURE_LFENCE_RDTSC) #ifdef CONFIG_X86_PPRO_FENCE #define dma_rmb() rmb() #else # 58 "./arch/x86/include/asm/barrier.h" #define dma_rmb() barrier() #endif # 60 "./arch/x86/include/asm/barrier.h" #define dma_wmb() barrier() #ifdef CONFIG_X86_32 #define __smp_mb() asm volatile("lock; addl $0,-4(%%esp)" ::: "memory", "cc") #else # 65 "./arch/x86/include/asm/barrier.h" #define __smp_mb() asm volatile("lock; addl $0,-4(%%rsp)" ::: "memory", "cc") #endif # 67 "./arch/x86/include/asm/barrier.h" #define __smp_rmb() dma_rmb() #define __smp_wmb() barrier() #define __smp_store_mb(var, value) do { (void)xchg(&var, value); } while (0) #if defined(CONFIG_X86_PPRO_FENCE) /* * For this option x86 doesn't have a strong TSO memory * model and we should fall back to full barriers. */ #define __smp_store_release(p, v) \ do { \ compiletime_assert_atomic_type(*p); \ __smp_mb(); \ WRITE_ONCE(*p, v); \ } while (0) #define __smp_load_acquire(p) \ ({ \ typeof(*p) ___p1 = READ_ONCE(*p); \ compiletime_assert_atomic_type(*p); \ __smp_mb(); \ ___p1; \ }) #else /* regular x86 TSO memory ordering */ # 94 "./arch/x86/include/asm/barrier.h" #define __smp_store_release(p, v) \ do { \ compiletime_assert_atomic_type(*p); \ barrier(); \ WRITE_ONCE(*p, v); \ } while (0) #define __smp_load_acquire(p) \ ({ \ typeof(*p) ___p1 = READ_ONCE(*p); \ compiletime_assert_atomic_type(*p); \ barrier(); \ ___p1; \ }) #endif # 111 "./arch/x86/include/asm/barrier.h" /* Atomic operations are already serializing on x86 */ #define __smp_mb__before_atomic() barrier() #define __smp_mb__after_atomic() barrier() #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 116 "./arch/x86/include/asm/barrier.h" # 1 "./include/asm-generic/barrier.h" 1 /* * Generic barrier definitions, originally based on MN10300 definitions. * * It should be possible to use these on really simple architectures, * but it serves more as a starting point for new ports. * * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public Licence * as published by the Free Software Foundation; either version * 2 of the Licence, or (at your option) any later version. */ #ifndef __ASM_GENERIC_BARRIER_H #define __ASM_GENERIC_BARRIER_H #ifndef __ASSEMBLY__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 20 "./include/asm-generic/barrier.h" # 1 "./include/linux/compiler.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __LINUX_COMPILER_H #define __LINUX_COMPILER_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/linux/compiler.h" # 6 "./include/linux/compiler.h" #ifndef __ASSEMBLY__ #ifdef __KERNEL__ /* * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code * to disable branch tracing on a per file basis. */ #if defined(CONFIG_TRACE_BRANCH_PROFILING) \ && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__) void ftrace_likely_update(struct ftrace_likely_data *f, int val, int expect, int is_constant); #define likely_notrace(x) __builtin_expect(!!(x), 1) #define unlikely_notrace(x) __builtin_expect(!!(x), 0) #define __branch_check__(x, expect, is_constant) ({ \ int ______r; \ static struct ftrace_likely_data \ __attribute__((__aligned__(4))) \ __attribute__((section("_ftrace_annotated_branch"))) \ ______f = { \ .data.func = __func__, \ .data.file = __FILE__, \ .data.line = __LINE__, \ }; \ ______r = __builtin_expect(!!(x), expect); \ ftrace_likely_update(&______f, ______r, \ expect, is_constant); \ ______r; \ }) /* * Using __builtin_constant_p(x) to ignore cases where the return * value is always the same. This idea is taken from a similar patch * written by Daniel Walker. */ # ifndef likely # define likely(x) (__branch_check__(x, 1, __builtin_constant_p(x))) # endif # 47 "./include/linux/compiler.h" # ifndef unlikely # define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x))) # endif # 50 "./include/linux/compiler.h" #ifdef CONFIG_PROFILE_ALL_BRANCHES /* * "Define 'is'", Bill Clinton * "Define 'if'", Steven Rostedt */ #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) #define __trace_if(cond) \ if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ({ \ int ______r; \ static struct ftrace_branch_data \ __attribute__((__aligned__(4))) \ __attribute__((section("_ftrace_branch"))) \ ______f = { \ .func = __func__, \ .file = __FILE__, \ .line = __LINE__, \ }; \ ______r = !!(cond); \ ______f.miss_hit[______r]++; \ ______r; \ })) #endif /* CONFIG_PROFILE_ALL_BRANCHES */ # 74 "./include/linux/compiler.h" #else # 76 "./include/linux/compiler.h" # define likely(x) __builtin_expect(!!(x), 1) # define unlikely(x) __builtin_expect(!!(x), 0) #endif # 79 "./include/linux/compiler.h" /* Optimization barrier */ #ifndef barrier # define barrier() __memory_barrier() #endif # 84 "./include/linux/compiler.h" #ifndef barrier_data # define barrier_data(ptr) barrier() #endif # 88 "./include/linux/compiler.h" /* Unreachable code */ #ifdef CONFIG_STACK_VALIDATION /* * These macros help objtool understand GCC code flow for unreachable code. * The __COUNTER__ based labels are a hack to make each instance of the macros * unique, to convince GCC not to merge duplicate inline asm statements. */ #define annotate_reachable() ({ \ asm volatile("%c0:\n\t" \ ".pushsection .discard.reachable\n\t" \ ".long %c0b - .\n\t" \ ".popsection\n\t" : : "i" (__COUNTER__)); \ }) #define annotate_unreachable() ({ \ asm volatile("%c0:\n\t" \ ".pushsection .discard.unreachable\n\t" \ ".long %c0b - .\n\t" \ ".popsection\n\t" : : "i" (__COUNTER__)); \ }) #define ASM_UNREACHABLE \ "999:\n\t" \ ".pushsection .discard.unreachable\n\t" \ ".long 999b - .\n\t" \ ".popsection\n\t" #else # 114 "./include/linux/compiler.h" #define annotate_reachable() #define annotate_unreachable() #endif # 117 "./include/linux/compiler.h" #ifndef ASM_UNREACHABLE # define ASM_UNREACHABLE #endif # 121 "./include/linux/compiler.h" #ifndef unreachable # define unreachable() do { annotate_reachable(); do { } while (1); } while (0) #endif # 124 "./include/linux/compiler.h" /* * KENTRY - kernel entry point * This can be used to annotate symbols (functions or data) that are used * without their linker symbol being referenced explicitly. For example, * interrupt vector handlers, or functions in the kernel image that are found * programatically. * * Not required for symbols exported with EXPORT_SYMBOL, or initcalls. Those * are handled in their own way (with KEEP() in linker scripts). * * KENTRY can be avoided if the symbols in question are marked as KEEP() in the * linker script. For example an architecture could KEEP() its entire * boot/exception vector code rather than annotate each function and data. */ #ifndef KENTRY # define KENTRY(sym) \ extern typeof(sym) sym; \ static const unsigned long __kentry_##sym \ __used \ __attribute__((section("___kentry" "+" #sym ), used)) \ = (unsigned long)&sym; #endif # 147 "./include/linux/compiler.h" #ifndef RELOC_HIDE # define RELOC_HIDE(ptr, off) \ ({ unsigned long __ptr; \ __ptr = (unsigned long) (ptr); \ (typeof(ptr)) (__ptr + (off)); }) #endif # 154 "./include/linux/compiler.h" #ifndef OPTIMIZER_HIDE_VAR #define OPTIMIZER_HIDE_VAR(var) barrier() #endif # 158 "./include/linux/compiler.h" /* Not-quite-unique ID. */ #ifndef __UNIQUE_ID # define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) #endif # 163 "./include/linux/compiler.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 164 "./include/linux/compiler.h" # 165 "./include/linux/compiler.h" #define __READ_ONCE_SIZE \ ({ \ switch (size) { \ case 1: *(__u8 *)res = *(volatile __u8 *)p; break; \ case 2: *(__u16 *)res = *(volatile __u16 *)p; break; \ case 4: *(__u32 *)res = *(volatile __u32 *)p; break; \ case 8: *(__u64 *)res = *(volatile __u64 *)p; break; \ default: \ barrier(); \ __builtin_memcpy((void *)res, (const void *)p, size); \ barrier(); \ } \ }) static __always_inline void __read_once_size(const volatile void *p, void *res, int size) { __READ_ONCE_SIZE; } #ifdef CONFIG_KASAN /* * This function is not 'inline' because __no_sanitize_address confilcts * with inlining. Attempt to inline it may cause a build failure. * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 * '__maybe_unused' allows us to avoid defined-but-not-used warnings. */ static __no_sanitize_address __maybe_unused void __read_once_size_nocheck(const volatile void *p, void *res, int size) { __READ_ONCE_SIZE; } #else # 199 "./include/linux/compiler.h" static __always_inline void __read_once_size_nocheck(const volatile void *p, void *res, int size) { __READ_ONCE_SIZE; } #endif # 205 "./include/linux/compiler.h" static __always_inline void __write_once_size(volatile void *p, void *res, int size) { switch (size) { case 1: *(volatile __u8 *)p = *(__u8 *)res; break; case 2: *(volatile __u16 *)p = *(__u16 *)res; break; case 4: *(volatile __u32 *)p = *(__u32 *)res; break; case 8: *(volatile __u64 *)p = *(__u64 *)res; break; default: barrier(); __builtin_memcpy((void *)p, (const void *)res, size); barrier(); } } /* * Prevent the compiler from merging or refetching reads or writes. The * compiler is also forbidden from reordering successive instances of * READ_ONCE and WRITE_ONCE, but only when the compiler is aware of some * particular ordering. One way to make the compiler aware of ordering is to * put the two invocations of READ_ONCE or WRITE_ONCE in different C * statements. * * These two macros will also work on aggregate data types like structs or * unions. If the size of the accessed data type exceeds the word size of * the machine (e.g., 32 bits or 64 bits) READ_ONCE() and WRITE_ONCE() will * fall back to memcpy(). There's at least two memcpy()s: one for the * __builtin_memcpy() and then one for the macro doing the copy of variable * - '__u' allocated on the stack. * * Their two major use cases are: (1) Mediating communication between * process-level code and irq/NMI handlers, all running on the same CPU, * and (2) Ensuring that the compiler does not fold, spindle, or otherwise * mutilate accesses that either do not require ordering or that interact * with an explicit memory barrier or atomic instruction that provides the * required ordering. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 242 "./include/linux/compiler.h" # 243 "./include/linux/compiler.h" #define __READ_ONCE(x, check) \ ({ \ union { typeof(x) __val; char __c[1]; } __u; \ if (check) \ __read_once_size(&(x), __u.__c, sizeof(x)); \ else \ __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \ smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \ __u.__val; \ }) #define READ_ONCE(x) __READ_ONCE(x, 1) /* * Use READ_ONCE_NOCHECK() instead of READ_ONCE() if you need * to hide memory access from KASAN. */ #define READ_ONCE_NOCHECK(x) __READ_ONCE(x, 0) #define WRITE_ONCE(x, val) \ ({ \ union { typeof(x) __val; char __c[1]; } __u = \ { .__val = (__force typeof(x)) (val) }; \ __write_once_size(&(x), __u.__c, sizeof(x)); \ __u.__val; \ }) #endif /* __KERNEL__ */ # 271 "./include/linux/compiler.h" #endif /* __ASSEMBLY__ */ # 273 "./include/linux/compiler.h" /* Compile time object size, -1 for unknown */ #ifndef __compiletime_object_size # define __compiletime_object_size(obj) -1 #endif # 278 "./include/linux/compiler.h" #ifndef __compiletime_warning # define __compiletime_warning(message) #endif # 281 "./include/linux/compiler.h" #ifndef __compiletime_error # define __compiletime_error(message) /* * Sparse complains of variable sized arrays due to the temporary variable in * __compiletime_assert. Unfortunately we can't just expand it out to make * sparse see a constant array size without breaking compiletime_assert on old * versions of GCC (e.g. 4.2.4), so hide the array from sparse altogether. */ # ifndef __CHECKER__ # define __compiletime_error_fallback(condition) \ do { ((void)sizeof(char[1 - 2 * condition])); } while (0) # endif # 293 "./include/linux/compiler.h" #endif # 294 "./include/linux/compiler.h" #ifndef __compiletime_error_fallback # define __compiletime_error_fallback(condition) do { } while (0) #endif # 297 "./include/linux/compiler.h" #ifdef __OPTIMIZE__ # define __compiletime_assert(condition, msg, prefix, suffix) \ do { \ bool __cond = !(condition); \ extern void prefix ## suffix(void) __compiletime_error(msg); \ if (__cond) \ prefix ## suffix(); \ __compiletime_error_fallback(__cond); \ } while (0) #else # 308 "./include/linux/compiler.h" # define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0) #endif # 310 "./include/linux/compiler.h" #define _compiletime_assert(condition, msg, prefix, suffix) \ __compiletime_assert(condition, msg, prefix, suffix) /** * compiletime_assert - break build and emit msg if condition is false * @condition: a compile-time constant condition to check * @msg: a message to emit if condition is false * * In tradition of POSIX assert, this macro will break the build if the * supplied condition is *false*, emitting the supplied error message if the * compiler has support to do so. */ #define compiletime_assert(condition, msg) \ _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) #define compiletime_assert_atomic_type(t) \ compiletime_assert(__native_word(t), \ "Need native word sized stores/loads for atomicity.") #endif /* __LINUX_COMPILER_H */ # 331 "./include/linux/compiler.h" # 21 "./include/asm-generic/barrier.h" 2 #ifndef nop #define nop() asm volatile ("nop") #endif # 25 "./include/asm-generic/barrier.h" /* * Force strict CPU ordering. And yes, this is required on UP too when we're * talking to devices. * * Fall back to compiler barriers if nothing better is provided. */ #ifndef mb #define mb() barrier() #endif # 36 "./include/asm-generic/barrier.h" #ifndef rmb #define rmb() mb() #endif # 40 "./include/asm-generic/barrier.h" #ifndef wmb #define wmb() mb() #endif # 44 "./include/asm-generic/barrier.h" #ifndef dma_rmb #define dma_rmb() rmb() #endif # 48 "./include/asm-generic/barrier.h" #ifndef dma_wmb #define dma_wmb() wmb() #endif # 52 "./include/asm-generic/barrier.h" #ifndef read_barrier_depends #define read_barrier_depends() do { } while (0) #endif # 56 "./include/asm-generic/barrier.h" #ifndef __smp_mb #define __smp_mb() mb() #endif # 60 "./include/asm-generic/barrier.h" #ifndef __smp_rmb #define __smp_rmb() rmb() #endif # 64 "./include/asm-generic/barrier.h" #ifndef __smp_wmb #define __smp_wmb() wmb() #endif # 68 "./include/asm-generic/barrier.h" #ifndef __smp_read_barrier_depends #define __smp_read_barrier_depends() read_barrier_depends() #endif # 72 "./include/asm-generic/barrier.h" #ifdef CONFIG_SMP #ifndef smp_mb #define smp_mb() __smp_mb() #endif # 78 "./include/asm-generic/barrier.h" #ifndef smp_rmb #define smp_rmb() __smp_rmb() #endif # 82 "./include/asm-generic/barrier.h" #ifndef smp_wmb #define smp_wmb() __smp_wmb() #endif # 86 "./include/asm-generic/barrier.h" #ifndef smp_read_barrier_depends #define smp_read_barrier_depends() __smp_read_barrier_depends() #endif # 90 "./include/asm-generic/barrier.h" #else /* !CONFIG_SMP */ # 92 "./include/asm-generic/barrier.h" #ifndef smp_mb #define smp_mb() barrier() #endif # 96 "./include/asm-generic/barrier.h" #ifndef smp_rmb #define smp_rmb() barrier() #endif # 100 "./include/asm-generic/barrier.h" #ifndef smp_wmb #define smp_wmb() barrier() #endif # 104 "./include/asm-generic/barrier.h" #ifndef smp_read_barrier_depends #define smp_read_barrier_depends() do { } while (0) #endif # 108 "./include/asm-generic/barrier.h" #endif /* CONFIG_SMP */ # 110 "./include/asm-generic/barrier.h" #ifndef __smp_store_mb #define __smp_store_mb(var, value) do { WRITE_ONCE(var, value); __smp_mb(); } while (0) #endif # 114 "./include/asm-generic/barrier.h" #ifndef __smp_mb__before_atomic #define __smp_mb__before_atomic() __smp_mb() #endif # 118 "./include/asm-generic/barrier.h" #ifndef __smp_mb__after_atomic #define __smp_mb__after_atomic() __smp_mb() #endif # 122 "./include/asm-generic/barrier.h" #ifndef __smp_store_release #define __smp_store_release(p, v) \ do { \ compiletime_assert_atomic_type(*p); \ __smp_mb(); \ WRITE_ONCE(*p, v); \ } while (0) #endif # 131 "./include/asm-generic/barrier.h" #ifndef __smp_load_acquire #define __smp_load_acquire(p) \ ({ \ typeof(*p) ___p1 = READ_ONCE(*p); \ compiletime_assert_atomic_type(*p); \ __smp_mb(); \ ___p1; \ }) #endif # 141 "./include/asm-generic/barrier.h" #ifdef CONFIG_SMP #ifndef smp_store_mb #define smp_store_mb(var, value) __smp_store_mb(var, value) #endif # 147 "./include/asm-generic/barrier.h" #ifndef smp_mb__before_atomic #define smp_mb__before_atomic() __smp_mb__before_atomic() #endif # 151 "./include/asm-generic/barrier.h" #ifndef smp_mb__after_atomic #define smp_mb__after_atomic() __smp_mb__after_atomic() #endif # 155 "./include/asm-generic/barrier.h" #ifndef smp_store_release #define smp_store_release(p, v) __smp_store_release(p, v) #endif # 159 "./include/asm-generic/barrier.h" #ifndef smp_load_acquire #define smp_load_acquire(p) __smp_load_acquire(p) #endif # 163 "./include/asm-generic/barrier.h" #else /* !CONFIG_SMP */ # 165 "./include/asm-generic/barrier.h" #ifndef smp_store_mb #define smp_store_mb(var, value) do { WRITE_ONCE(var, value); barrier(); } while (0) #endif # 169 "./include/asm-generic/barrier.h" #ifndef smp_mb__before_atomic #define smp_mb__before_atomic() barrier() #endif # 173 "./include/asm-generic/barrier.h" #ifndef smp_mb__after_atomic #define smp_mb__after_atomic() barrier() #endif # 177 "./include/asm-generic/barrier.h" #ifndef smp_store_release #define smp_store_release(p, v) \ do { \ compiletime_assert_atomic_type(*p); \ barrier(); \ WRITE_ONCE(*p, v); \ } while (0) #endif # 186 "./include/asm-generic/barrier.h" #ifndef smp_load_acquire #define smp_load_acquire(p) \ ({ \ typeof(*p) ___p1 = READ_ONCE(*p); \ compiletime_assert_atomic_type(*p); \ barrier(); \ ___p1; \ }) #endif # 196 "./include/asm-generic/barrier.h" #endif /* CONFIG_SMP */ # 198 "./include/asm-generic/barrier.h" /* Barriers for virtual machine guests when talking to an SMP host */ #define virt_mb() __smp_mb() #define virt_rmb() __smp_rmb() #define virt_wmb() __smp_wmb() #define virt_read_barrier_depends() __smp_read_barrier_depends() #define virt_store_mb(var, value) __smp_store_mb(var, value) #define virt_mb__before_atomic() __smp_mb__before_atomic() #define virt_mb__after_atomic() __smp_mb__after_atomic() #define virt_store_release(p, v) __smp_store_release(p, v) #define virt_load_acquire(p) __smp_load_acquire(p) /** * smp_acquire__after_ctrl_dep() - Provide ACQUIRE ordering after a control dependency * * A control dependency provides a LOAD->STORE order, the additional RMB * provides LOAD->LOAD order, together they provide LOAD->{LOAD,STORE} order, * aka. (load)-ACQUIRE. * * Architectures that do not do load speculation can have this be barrier(). */ #ifndef smp_acquire__after_ctrl_dep #define smp_acquire__after_ctrl_dep() smp_rmb() #endif # 222 "./include/asm-generic/barrier.h" /** * smp_cond_load_acquire() - (Spin) wait for cond with ACQUIRE ordering * @ptr: pointer to the variable to wait on * @cond: boolean expression to wait for * * Equivalent to using smp_load_acquire() on the condition variable but employs * the control dependency of the wait to reduce the barrier on many platforms. * * Due to C lacking lambda expressions we load the value of *ptr into a * pre-named variable @VAL to be used in @cond. */ #ifndef smp_cond_load_acquire #define smp_cond_load_acquire(ptr, cond_expr) ({ \ typeof(ptr) __PTR = (ptr); \ typeof(*ptr) VAL; \ for (;;) { \ VAL = READ_ONCE(*__PTR); \ if (cond_expr) \ break; \ cpu_relax(); \ } \ smp_acquire__after_ctrl_dep(); \ VAL; \ }) #endif # 248 "./include/asm-generic/barrier.h" #endif /* !__ASSEMBLY__ */ # 250 "./include/asm-generic/barrier.h" #endif /* __ASM_GENERIC_BARRIER_H */ # 251 "./include/asm-generic/barrier.h" # 117 "./arch/x86/include/asm/barrier.h" 2 #endif /* _ASM_X86_BARRIER_H */ # 119 "./arch/x86/include/asm/barrier.h" # 243 "./include/linux/compiler.h" 2 #define __READ_ONCE(x, check) \ ({ \ union { typeof(x) __val; char __c[1]; } __u; \ if (check) \ __read_once_size(&(x), __u.__c, sizeof(x)); \ else \ __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \ smp_read_barrier_depends(); /* Enforce dependency ordering from x */ \ __u.__val; \ }) #define READ_ONCE(x) __READ_ONCE(x, 1) /* * Use READ_ONCE_NOCHECK() instead of READ_ONCE() if you need * to hide memory access from KASAN. */ #define READ_ONCE_NOCHECK(x) __READ_ONCE(x, 0) #define WRITE_ONCE(x, val) \ ({ \ union { typeof(x) __val; char __c[1]; } __u = \ { .__val = (__force typeof(x)) (val) }; \ __write_once_size(&(x), __u.__c, sizeof(x)); \ __u.__val; \ }) #endif /* __KERNEL__ */ # 271 "./include/linux/compiler.h" #endif /* __ASSEMBLY__ */ # 273 "./include/linux/compiler.h" /* Compile time object size, -1 for unknown */ #ifndef __compiletime_object_size # define __compiletime_object_size(obj) -1 #endif # 278 "./include/linux/compiler.h" #ifndef __compiletime_warning # define __compiletime_warning(message) #endif # 281 "./include/linux/compiler.h" #ifndef __compiletime_error # define __compiletime_error(message) /* * Sparse complains of variable sized arrays due to the temporary variable in * __compiletime_assert. Unfortunately we can't just expand it out to make * sparse see a constant array size without breaking compiletime_assert on old * versions of GCC (e.g. 4.2.4), so hide the array from sparse altogether. */ # ifndef __CHECKER__ # define __compiletime_error_fallback(condition) \ do { ((void)sizeof(char[1 - 2 * condition])); } while (0) # endif # 293 "./include/linux/compiler.h" #endif # 294 "./include/linux/compiler.h" #ifndef __compiletime_error_fallback # define __compiletime_error_fallback(condition) do { } while (0) #endif # 297 "./include/linux/compiler.h" #ifdef __OPTIMIZE__ # define __compiletime_assert(condition, msg, prefix, suffix) \ do { \ bool __cond = !(condition); \ extern void prefix ## suffix(void) __compiletime_error(msg); \ if (__cond) \ prefix ## suffix(); \ __compiletime_error_fallback(__cond); \ } while (0) #else # 308 "./include/linux/compiler.h" # define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0) #endif # 310 "./include/linux/compiler.h" #define _compiletime_assert(condition, msg, prefix, suffix) \ __compiletime_assert(condition, msg, prefix, suffix) /** * compiletime_assert - break build and emit msg if condition is false * @condition: a compile-time constant condition to check * @msg: a message to emit if condition is false * * In tradition of POSIX assert, this macro will break the build if the * supplied condition is *false*, emitting the supplied error message if the * compiler has support to do so. */ #define compiletime_assert(condition, msg) \ _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) #define compiletime_assert_atomic_type(t) \ compiletime_assert(__native_word(t), \ "Need native word sized stores/loads for atomicity.") #endif /* __LINUX_COMPILER_H */ # 331 "./include/linux/compiler.h" # 7 "./include/linux/string.h" 2 #if 0 /* expanded by -frewrite-includes */ #include /* for size_t */ #endif /* expanded by -frewrite-includes */ # 7 "./include/linux/string.h" # 8 "./include/linux/string.h" #if 0 /* expanded by -frewrite-includes */ #include /* for NULL */ #endif /* expanded by -frewrite-includes */ # 8 "./include/linux/string.h" # 9 "./include/linux/string.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 9 "./include/linux/string.h" # 1 "/home/dwmw2/git/llvm6/lib/clang/6.0.0/include/stdarg.h" 1 3 /*===---- stdarg.h - Variable argument handling ----------------------------=== * * Copyright (c) 2008 Eli Friedman * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __STDARG_H #define __STDARG_H #ifndef _VA_LIST typedef __builtin_va_list va_list; #define _VA_LIST #endif # 33 "/home/dwmw2/git/llvm6/lib/clang/6.0.0/include/stdarg.h" 3 #define va_start(ap, param) __builtin_va_start(ap, param) #define va_end(ap) __builtin_va_end(ap) #define va_arg(ap, type) __builtin_va_arg(ap, type) /* GCC always defines __va_copy, but does not define va_copy unless in c99 mode * or -ansi is not specified, since it was not part of C90. */ #define __va_copy(d,s) __builtin_va_copy(d,s) #if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L || !defined(__STRICT_ANSI__) #define va_copy(dest, src) __builtin_va_copy(dest, src) #endif # 45 "/home/dwmw2/git/llvm6/lib/clang/6.0.0/include/stdarg.h" 3 #ifndef __GNUC_VA_LIST #define __GNUC_VA_LIST 1 typedef __builtin_va_list __gnuc_va_list; #endif # 50 "/home/dwmw2/git/llvm6/lib/clang/6.0.0/include/stdarg.h" 3 #endif /* __STDARG_H */ # 52 "/home/dwmw2/git/llvm6/lib/clang/6.0.0/include/stdarg.h" 3 # 10 "./include/linux/string.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 10 "./include/linux/string.h" # 1 "./include/uapi/linux/string.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UAPI_LINUX_STRING_H_ #define _UAPI_LINUX_STRING_H_ /* We don't want strings.h stuff being used by user stuff by accident */ #ifndef __KERNEL__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 8 "./include/uapi/linux/string.h" # 9 "./include/uapi/linux/string.h" #endif /* __KERNEL__ */ # 10 "./include/uapi/linux/string.h" #endif /* _UAPI_LINUX_STRING_H_ */ # 11 "./include/uapi/linux/string.h" # 11 "./include/linux/string.h" 2 extern char *strndup_user(const char __user *, long); extern void *memdup_user(const void __user *, size_t); extern void *memdup_user_nul(const void __user *, size_t); /* * Include machine specific inline routines */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 19 "./include/linux/string.h" # 1 "./arch/x86/include/asm/string.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifdef CONFIG_X86_32 #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 3 "./arch/x86/include/asm/string.h" # 1 "./arch/x86/include/asm/string_32.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_STRING_32_H #define _ASM_X86_STRING_32_H #ifdef __KERNEL__ /* Let gcc decide whether to inline or use the out of line functions */ #define __HAVE_ARCH_STRCPY extern char *strcpy(char *dest, const char *src); #define __HAVE_ARCH_STRNCPY extern char *strncpy(char *dest, const char *src, size_t count); #define __HAVE_ARCH_STRCAT extern char *strcat(char *dest, const char *src); #define __HAVE_ARCH_STRNCAT extern char *strncat(char *dest, const char *src, size_t count); #define __HAVE_ARCH_STRCMP extern int strcmp(const char *cs, const char *ct); #define __HAVE_ARCH_STRNCMP extern int strncmp(const char *cs, const char *ct, size_t count); #define __HAVE_ARCH_STRCHR extern char *strchr(const char *s, int c); #define __HAVE_ARCH_STRLEN extern size_t strlen(const char *s); static __always_inline void *__memcpy(void *to, const void *from, size_t n) { int d0, d1, d2; asm volatile("rep ; movsl\n\t" "movl %4,%%ecx\n\t" "andl $3,%%ecx\n\t" "jz 1f\n\t" "rep ; movsb\n\t" "1:" : "=&c" (d0), "=&D" (d1), "=&S" (d2) : "0" (n / 4), "g" (n), "1" ((long)to), "2" ((long)from) : "memory"); return to; } /* * This looks ugly, but the compiler can optimize it totally, * as the count is constant. */ static __always_inline void *__constant_memcpy(void *to, const void *from, size_t n) { long esi, edi; if (!n) return to; switch (n) { case 1: *(char *)to = *(char *)from; return to; case 2: *(short *)to = *(short *)from; return to; case 4: *(int *)to = *(int *)from; return to; case 3: *(short *)to = *(short *)from; *((char *)to + 2) = *((char *)from + 2); return to; case 5: *(int *)to = *(int *)from; *((char *)to + 4) = *((char *)from + 4); return to; case 6: *(int *)to = *(int *)from; *((short *)to + 2) = *((short *)from + 2); return to; case 8: *(int *)to = *(int *)from; *((int *)to + 1) = *((int *)from + 1); return to; } esi = (long)from; edi = (long)to; if (n >= 5 * 4) { /* large block: use rep prefix */ int ecx; asm volatile("rep ; movsl" : "=&c" (ecx), "=&D" (edi), "=&S" (esi) : "0" (n / 4), "1" (edi), "2" (esi) : "memory" ); } else { /* small block: don't clobber ecx + smaller code */ if (n >= 4 * 4) asm volatile("movsl" : "=&D"(edi), "=&S"(esi) : "0"(edi), "1"(esi) : "memory"); if (n >= 3 * 4) asm volatile("movsl" : "=&D"(edi), "=&S"(esi) : "0"(edi), "1"(esi) : "memory"); if (n >= 2 * 4) asm volatile("movsl" : "=&D"(edi), "=&S"(esi) : "0"(edi), "1"(esi) : "memory"); if (n >= 1 * 4) asm volatile("movsl" : "=&D"(edi), "=&S"(esi) : "0"(edi), "1"(esi) : "memory"); } switch (n % 4) { /* tail */ case 0: return to; case 1: asm volatile("movsb" : "=&D"(edi), "=&S"(esi) : "0"(edi), "1"(esi) : "memory"); return to; case 2: asm volatile("movsw" : "=&D"(edi), "=&S"(esi) : "0"(edi), "1"(esi) : "memory"); return to; default: asm volatile("movsw\n\tmovsb" : "=&D"(edi), "=&S"(esi) : "0"(edi), "1"(esi) : "memory"); return to; } } #define __HAVE_ARCH_MEMCPY extern void *memcpy(void *, const void *, size_t); #ifndef CONFIG_FORTIFY_SOURCE #ifdef CONFIG_X86_USE_3DNOW #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 151 "./arch/x86/include/asm/string_32.h" # 152 "./arch/x86/include/asm/string_32.h" /* * This CPU favours 3DNow strongly (eg AMD Athlon) */ static inline void *__constant_memcpy3d(void *to, const void *from, size_t len) { if (len < 512) return __constant_memcpy(to, from, len); return _mmx_memcpy(to, from, len); } static inline void *__memcpy3d(void *to, const void *from, size_t len) { if (len < 512) return __memcpy(to, from, len); return _mmx_memcpy(to, from, len); } #define memcpy(t, f, n) \ (__builtin_constant_p((n)) \ ? __constant_memcpy3d((t), (f), (n)) \ : __memcpy3d((t), (f), (n))) #else # 177 "./arch/x86/include/asm/string_32.h" /* * No 3D Now! */ #if (__GNUC__ >= 4) #define memcpy(t, f, n) __builtin_memcpy(t, f, n) #else # 185 "./arch/x86/include/asm/string_32.h" #define memcpy(t, f, n) \ (__builtin_constant_p((n)) \ ? __constant_memcpy((t), (f), (n)) \ : __memcpy((t), (f), (n))) #endif # 190 "./arch/x86/include/asm/string_32.h" #endif # 192 "./arch/x86/include/asm/string_32.h" #endif /* !CONFIG_FORTIFY_SOURCE */ # 193 "./arch/x86/include/asm/string_32.h" #define __HAVE_ARCH_MEMMOVE void *memmove(void *dest, const void *src, size_t n); extern int memcmp(const void *, const void *, size_t); #ifndef CONFIG_FORTIFY_SOURCE #define memcmp __builtin_memcmp #endif # 201 "./arch/x86/include/asm/string_32.h" #define __HAVE_ARCH_MEMCHR extern void *memchr(const void *cs, int c, size_t count); static inline void *__memset_generic(void *s, char c, size_t count) { int d0, d1; asm volatile("rep\n\t" "stosb" : "=&c" (d0), "=&D" (d1) : "a" (c), "1" (s), "0" (count) : "memory"); return s; } /* we might want to write optimized versions of these later */ #define __constant_count_memset(s, c, count) __memset_generic((s), (c), (count)) /* * memset(x, 0, y) is a reasonably common thing to do, so we want to fill * things 32 bits at a time even when we don't know the size of the * area at compile-time.. */ static __always_inline void *__constant_c_memset(void *s, unsigned long c, size_t count) { int d0, d1; asm volatile("rep ; stosl\n\t" "testb $2,%b3\n\t" "je 1f\n\t" "stosw\n" "1:\ttestb $1,%b3\n\t" "je 2f\n\t" "stosb\n" "2:" : "=&c" (d0), "=&D" (d1) : "a" (c), "q" (count), "0" (count/4), "1" ((long)s) : "memory"); return s; } /* Added by Gertjan van Wingerde to make minix and sysv module work */ #define __HAVE_ARCH_STRNLEN extern size_t strnlen(const char *s, size_t count); /* end of additional stuff */ #define __HAVE_ARCH_STRSTR extern char *strstr(const char *cs, const char *ct); /* * This looks horribly ugly, but the compiler can optimize it totally, * as we by now know that both pattern and count is constant.. */ static __always_inline void *__constant_c_and_count_memset(void *s, unsigned long pattern, size_t count) { switch (count) { case 0: return s; case 1: *(unsigned char *)s = pattern & 0xff; return s; case 2: *(unsigned short *)s = pattern & 0xffff; return s; case 3: *(unsigned short *)s = pattern & 0xffff; *((unsigned char *)s + 2) = pattern & 0xff; return s; case 4: *(unsigned long *)s = pattern; return s; } #define COMMON(x) \ asm volatile("rep ; stosl" \ x \ : "=&c" (d0), "=&D" (d1) \ : "a" (eax), "0" (count/4), "1" ((long)s) \ : "memory") { int d0, d1; #if __GNUC__ == 4 && __GNUC_MINOR__ == 0 /* Workaround for broken gcc 4.0 */ register unsigned long eax asm("%eax") = pattern; #else # 289 "./arch/x86/include/asm/string_32.h" unsigned long eax = pattern; #endif # 291 "./arch/x86/include/asm/string_32.h" switch (count % 4) { case 0: COMMON(""); return s; case 1: COMMON("\n\tstosb"); return s; case 2: COMMON("\n\tstosw"); return s; default: COMMON("\n\tstosw\n\tstosb"); return s; } } #undef COMMON } #define __constant_c_x_memset(s, c, count) \ (__builtin_constant_p(count) \ ? __constant_c_and_count_memset((s), (c), (count)) \ : __constant_c_memset((s), (c), (count))) #define __memset(s, c, count) \ (__builtin_constant_p(count) \ ? __constant_count_memset((s), (c), (count)) \ : __memset_generic((s), (c), (count))) #define __HAVE_ARCH_MEMSET extern void *memset(void *, int, size_t); #ifndef CONFIG_FORTIFY_SOURCE #if (__GNUC__ >= 4) #define memset(s, c, count) __builtin_memset(s, c, count) #else # 327 "./arch/x86/include/asm/string_32.h" #define memset(s, c, count) \ (__builtin_constant_p(c) \ ? __constant_c_x_memset((s), (0x01010101UL * (unsigned char)(c)), \ (count)) \ : __memset((s), (c), (count))) #endif # 333 "./arch/x86/include/asm/string_32.h" #endif /* !CONFIG_FORTIFY_SOURCE */ # 334 "./arch/x86/include/asm/string_32.h" #define __HAVE_ARCH_MEMSET16 static inline void *memset16(uint16_t *s, uint16_t v, size_t n) { int d0, d1; asm volatile("rep\n\t" "stosw" : "=&c" (d0), "=&D" (d1) : "a" (v), "1" (s), "0" (n) : "memory"); return s; } #define __HAVE_ARCH_MEMSET32 static inline void *memset32(uint32_t *s, uint32_t v, size_t n) { int d0, d1; asm volatile("rep\n\t" "stosl" : "=&c" (d0), "=&D" (d1) : "a" (v), "1" (s), "0" (n) : "memory"); return s; } /* * find the first occurrence of byte 'c', or 1 past the area if none */ #define __HAVE_ARCH_MEMSCAN extern void *memscan(void *addr, int c, size_t size); #endif /* __KERNEL__ */ # 366 "./arch/x86/include/asm/string_32.h" #endif /* _ASM_X86_STRING_32_H */ # 368 "./arch/x86/include/asm/string_32.h" # 4 "./arch/x86/include/asm/string.h" 2 #else # 5 "./arch/x86/include/asm/string.h" #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 5 "./arch/x86/include/asm/string.h" # 6 "./arch/x86/include/asm/string.h" #endif # 7 "./arch/x86/include/asm/string.h" # 20 "./include/linux/string.h" 2 #ifndef __HAVE_ARCH_STRCPY extern char * strcpy(char *,const char *); #endif # 24 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRNCPY extern char * strncpy(char *,const char *, __kernel_size_t); #endif # 27 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRLCPY size_t strlcpy(char *, const char *, size_t); #endif # 30 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRSCPY ssize_t __must_check strscpy(char *, const char *, size_t); #endif # 33 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRCAT extern char * strcat(char *, const char *); #endif # 36 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRNCAT extern char * strncat(char *, const char *, __kernel_size_t); #endif # 39 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRLCAT extern size_t strlcat(char *, const char *, __kernel_size_t); #endif # 42 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRCMP extern int strcmp(const char *,const char *); #endif # 45 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRNCMP extern int strncmp(const char *,const char *,__kernel_size_t); #endif # 48 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRCASECMP extern int strcasecmp(const char *s1, const char *s2); #endif # 51 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRNCASECMP extern int strncasecmp(const char *s1, const char *s2, size_t n); #endif # 54 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRCHR extern char * strchr(const char *,int); #endif # 57 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRCHRNUL extern char * strchrnul(const char *,int); #endif # 60 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRNCHR extern char * strnchr(const char *, size_t, int); #endif # 63 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRRCHR extern char * strrchr(const char *,int); #endif # 66 "./include/linux/string.h" extern char * __must_check skip_spaces(const char *); extern char *strim(char *); static inline __must_check char *strstrip(char *str) { return strim(str); } #ifndef __HAVE_ARCH_STRSTR extern char * strstr(const char *, const char *); #endif # 78 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRNSTR extern char * strnstr(const char *, const char *, size_t); #endif # 81 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRLEN extern __kernel_size_t strlen(const char *); #endif # 84 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRNLEN extern __kernel_size_t strnlen(const char *,__kernel_size_t); #endif # 87 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRPBRK extern char * strpbrk(const char *,const char *); #endif # 90 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRSEP extern char * strsep(char **,const char *); #endif # 93 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRSPN extern __kernel_size_t strspn(const char *,const char *); #endif # 96 "./include/linux/string.h" #ifndef __HAVE_ARCH_STRCSPN extern __kernel_size_t strcspn(const char *,const char *); #endif # 99 "./include/linux/string.h" #ifndef __HAVE_ARCH_MEMSET extern void * memset(void *,int,__kernel_size_t); #endif # 103 "./include/linux/string.h" #ifndef __HAVE_ARCH_MEMSET16 extern void *memset16(uint16_t *, uint16_t, __kernel_size_t); #endif # 107 "./include/linux/string.h" #ifndef __HAVE_ARCH_MEMSET32 extern void *memset32(uint32_t *, uint32_t, __kernel_size_t); #endif # 111 "./include/linux/string.h" #ifndef __HAVE_ARCH_MEMSET64 extern void *memset64(uint64_t *, uint64_t, __kernel_size_t); #endif # 115 "./include/linux/string.h" static inline void *memset_l(unsigned long *p, unsigned long v, __kernel_size_t n) { if (BITS_PER_LONG == 32) return memset32((uint32_t *)p, v, n); else return memset64((uint64_t *)p, v, n); } static inline void *memset_p(void **p, void *v, __kernel_size_t n) { if (BITS_PER_LONG == 32) return memset32((uint32_t *)p, (uintptr_t)v, n); else return memset64((uint64_t *)p, (uintptr_t)v, n); } #ifndef __HAVE_ARCH_MEMCPY extern void * memcpy(void *,const void *,__kernel_size_t); #endif # 136 "./include/linux/string.h" #ifndef __HAVE_ARCH_MEMMOVE extern void * memmove(void *,const void *,__kernel_size_t); #endif # 139 "./include/linux/string.h" #ifndef __HAVE_ARCH_MEMSCAN extern void * memscan(void *,int,__kernel_size_t); #endif # 142 "./include/linux/string.h" #ifndef __HAVE_ARCH_MEMCMP extern int memcmp(const void *,const void *,__kernel_size_t); #endif # 145 "./include/linux/string.h" #ifndef __HAVE_ARCH_MEMCHR extern void * memchr(const void *,int,__kernel_size_t); #endif # 148 "./include/linux/string.h" #ifndef __HAVE_ARCH_MEMCPY_MCSAFE static inline __must_check int memcpy_mcsafe(void *dst, const void *src, size_t cnt) { memcpy(dst, src, cnt); return 0; } #endif # 156 "./include/linux/string.h" #ifndef __HAVE_ARCH_MEMCPY_FLUSHCACHE static inline void memcpy_flushcache(void *dst, const void *src, size_t cnt) { memcpy(dst, src, cnt); } #endif # 162 "./include/linux/string.h" void *memchr_inv(const void *s, int c, size_t n); char *strreplace(char *s, char old, char new); extern void kfree_const(const void *x); extern char *kstrdup(const char *s, gfp_t gfp) __malloc; extern const char *kstrdup_const(const char *s, gfp_t gfp); extern char *kstrndup(const char *s, size_t len, gfp_t gfp); extern void *kmemdup(const void *src, size_t len, gfp_t gfp); extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp); extern char **argv_split(gfp_t gfp, const char *str, int *argcp); extern void argv_free(char **argv); extern bool sysfs_streq(const char *s1, const char *s2); extern int kstrtobool(const char *s, bool *res); static inline int strtobool(const char *s, bool *res) { return kstrtobool(s, res); } int match_string(const char * const *array, size_t n, const char *string); int __sysfs_match_string(const char * const *array, size_t n, const char *s); /** * sysfs_match_string - matches given string in an array * @_a: array of strings * @_s: string to match with * * Helper for __sysfs_match_string(). Calculates the size of @a automatically. */ #define sysfs_match_string(_a, _s) __sysfs_match_string(_a, ARRAY_SIZE(_a), _s) #ifdef CONFIG_BINARY_PRINTF int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args); int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf); int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4); #endif # 200 "./include/linux/string.h" extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, const void *from, size_t available); /** * strstarts - does @str start with @prefix? * @str: string to examine * @prefix: prefix to look for. */ static inline bool strstarts(const char *str, const char *prefix) { return strncmp(str, prefix, strlen(prefix)) == 0; } size_t memweight(const void *ptr, size_t bytes); void memzero_explicit(void *s, size_t count); /** * kbasename - return the last part of a pathname. * * @path: path to extract the filename from. */ static inline const char *kbasename(const char *path) { const char *tail = strrchr(path, '/'); return tail ? tail + 1 : path; } #define __FORTIFY_INLINE extern __always_inline __attribute__((gnu_inline)) #define __RENAME(x) __asm__(#x) void fortify_panic(const char *name) __noreturn __cold; void __read_overflow(void) __compiletime_error("detected read beyond size of object passed as 1st parameter"); void __read_overflow2(void) __compiletime_error("detected read beyond size of object passed as 2nd parameter"); void __read_overflow3(void) __compiletime_error("detected read beyond size of object passed as 3rd parameter"); void __write_overflow(void) __compiletime_error("detected write beyond size of object passed as 1st parameter"); #if !defined(__NO_FORTIFY) && defined(__OPTIMIZE__) && defined(CONFIG_FORTIFY_SOURCE) __FORTIFY_INLINE char *strncpy(char *p, const char *q, __kernel_size_t size) { size_t p_size = __builtin_object_size(p, 0); if (__builtin_constant_p(size) && p_size < size) __write_overflow(); if (p_size < size) fortify_panic(__func__); return __builtin_strncpy(p, q, size); } __FORTIFY_INLINE char *strcat(char *p, const char *q) { size_t p_size = __builtin_object_size(p, 0); if (p_size == (size_t)-1) return __builtin_strcat(p, q); if (strlcat(p, q, p_size) >= p_size) fortify_panic(__func__); return p; } __FORTIFY_INLINE __kernel_size_t strlen(const char *p) { __kernel_size_t ret; size_t p_size = __builtin_object_size(p, 0); /* Work around gcc excess stack consumption issue */ if (p_size == (size_t)-1 || (__builtin_constant_p(p[p_size - 1]) && p[p_size - 1] == '\0')) return __builtin_strlen(p); ret = strnlen(p, p_size); if (p_size <= ret) fortify_panic(__func__); return ret; } extern __kernel_size_t __real_strnlen(const char *, __kernel_size_t) __RENAME(strnlen); __FORTIFY_INLINE __kernel_size_t strnlen(const char *p, __kernel_size_t maxlen) { size_t p_size = __builtin_object_size(p, 0); __kernel_size_t ret = __real_strnlen(p, maxlen < p_size ? maxlen : p_size); if (p_size <= ret && maxlen != ret) fortify_panic(__func__); return ret; } /* defined after fortified strlen to reuse it */ extern size_t __real_strlcpy(char *, const char *, size_t) __RENAME(strlcpy); __FORTIFY_INLINE size_t strlcpy(char *p, const char *q, size_t size) { size_t ret; size_t p_size = __builtin_object_size(p, 0); size_t q_size = __builtin_object_size(q, 0); if (p_size == (size_t)-1 && q_size == (size_t)-1) return __real_strlcpy(p, q, size); ret = strlen(q); if (size) { size_t len = (ret >= size) ? size - 1 : ret; if (__builtin_constant_p(len) && len >= p_size) __write_overflow(); if (len >= p_size) fortify_panic(__func__); __builtin_memcpy(p, q, len); p[len] = '\0'; } return ret; } /* defined after fortified strlen and strnlen to reuse them */ __FORTIFY_INLINE char *strncat(char *p, const char *q, __kernel_size_t count) { size_t p_len, copy_len; size_t p_size = __builtin_object_size(p, 0); size_t q_size = __builtin_object_size(q, 0); if (p_size == (size_t)-1 && q_size == (size_t)-1) return __builtin_strncat(p, q, count); p_len = strlen(p); copy_len = strnlen(q, count); if (p_size < p_len + copy_len + 1) fortify_panic(__func__); __builtin_memcpy(p + p_len, q, copy_len); p[p_len + copy_len] = '\0'; return p; } __FORTIFY_INLINE void *memset(void *p, int c, __kernel_size_t size) { size_t p_size = __builtin_object_size(p, 0); if (__builtin_constant_p(size) && p_size < size) __write_overflow(); if (p_size < size) fortify_panic(__func__); return __builtin_memset(p, c, size); } __FORTIFY_INLINE void *memcpy(void *p, const void *q, __kernel_size_t size) { size_t p_size = __builtin_object_size(p, 0); size_t q_size = __builtin_object_size(q, 0); if (__builtin_constant_p(size)) { if (p_size < size) __write_overflow(); if (q_size < size) __read_overflow2(); } if (p_size < size || q_size < size) fortify_panic(__func__); return __builtin_memcpy(p, q, size); } __FORTIFY_INLINE void *memmove(void *p, const void *q, __kernel_size_t size) { size_t p_size = __builtin_object_size(p, 0); size_t q_size = __builtin_object_size(q, 0); if (__builtin_constant_p(size)) { if (p_size < size) __write_overflow(); if (q_size < size) __read_overflow2(); } if (p_size < size || q_size < size) fortify_panic(__func__); return __builtin_memmove(p, q, size); } extern void *__real_memscan(void *, int, __kernel_size_t) __RENAME(memscan); __FORTIFY_INLINE void *memscan(void *p, int c, __kernel_size_t size) { size_t p_size = __builtin_object_size(p, 0); if (__builtin_constant_p(size) && p_size < size) __read_overflow(); if (p_size < size) fortify_panic(__func__); return __real_memscan(p, c, size); } __FORTIFY_INLINE int memcmp(const void *p, const void *q, __kernel_size_t size) { size_t p_size = __builtin_object_size(p, 0); size_t q_size = __builtin_object_size(q, 0); if (__builtin_constant_p(size)) { if (p_size < size) __read_overflow(); if (q_size < size) __read_overflow2(); } if (p_size < size || q_size < size) fortify_panic(__func__); return __builtin_memcmp(p, q, size); } __FORTIFY_INLINE void *memchr(const void *p, int c, __kernel_size_t size) { size_t p_size = __builtin_object_size(p, 0); if (__builtin_constant_p(size) && p_size < size) __read_overflow(); if (p_size < size) fortify_panic(__func__); return __builtin_memchr(p, c, size); } void *__real_memchr_inv(const void *s, int c, size_t n) __RENAME(memchr_inv); __FORTIFY_INLINE void *memchr_inv(const void *p, int c, size_t size) { size_t p_size = __builtin_object_size(p, 0); if (__builtin_constant_p(size) && p_size < size) __read_overflow(); if (p_size < size) fortify_panic(__func__); return __real_memchr_inv(p, c, size); } extern void *__real_kmemdup(const void *src, size_t len, gfp_t gfp) __RENAME(kmemdup); __FORTIFY_INLINE void *kmemdup(const void *p, size_t size, gfp_t gfp) { size_t p_size = __builtin_object_size(p, 0); if (__builtin_constant_p(size) && p_size < size) __read_overflow(); if (p_size < size) fortify_panic(__func__); return __real_kmemdup(p, size, gfp); } /* defined after fortified strlen and memcpy to reuse them */ __FORTIFY_INLINE char *strcpy(char *p, const char *q) { size_t p_size = __builtin_object_size(p, 0); size_t q_size = __builtin_object_size(q, 0); if (p_size == (size_t)-1 && q_size == (size_t)-1) return __builtin_strcpy(p, q); memcpy(p, q, strlen(q) + 1); return p; } #endif # 432 "./include/linux/string.h" /** * memcpy_and_pad - Copy one buffer to another with padding * @dest: Where to copy to * @dest_len: The destination buffer size * @src: Where to copy from * @count: The number of bytes to copy * @pad: Character to use for padding if space is left in destination. */ static inline void memcpy_and_pad(void *dest, size_t dest_len, const void *src, size_t count, int pad) { if (dest_len > count) { memcpy(dest, src, count); memset(dest + count, pad, dest_len - count); } else memcpy(dest, src, dest_len); } #endif /* _LINUX_STRING_H_ */ # 452 "./include/linux/string.h" # 23 "./include/uapi/linux/uuid.h" 2 typedef struct { __u8 b[16]; } guid_t; #define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ ((guid_t) \ {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ (b) & 0xff, ((b) >> 8) & 0xff, \ (c) & 0xff, ((c) >> 8) & 0xff, \ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}) /* backwards compatibility, don't use in new code */ typedef guid_t uuid_le; #define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) #define NULL_UUID_LE \ UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00) #endif /* _UAPI_LINUX_UUID_H_ */ # 44 "./include/uapi/linux/uuid.h" # 20 "./include/linux/uuid.h" 2 #define UUID_SIZE 16 typedef struct { __u8 b[UUID_SIZE]; } uuid_t; #define UUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ ((uuid_t) \ {{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \ ((b) >> 8) & 0xff, (b) & 0xff, \ ((c) >> 8) & 0xff, (c) & 0xff, \ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}) /* * The length of a UUID string ("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") * not including trailing NUL. */ #define UUID_STRING_LEN 36 extern const guid_t guid_null; extern const uuid_t uuid_null; static inline bool guid_equal(const guid_t *u1, const guid_t *u2) { return memcmp(u1, u2, sizeof(guid_t)) == 0; } static inline void guid_copy(guid_t *dst, const guid_t *src) { memcpy(dst, src, sizeof(guid_t)); } static inline bool guid_is_null(const guid_t *guid) { return guid_equal(guid, &guid_null); } static inline bool uuid_equal(const uuid_t *u1, const uuid_t *u2) { return memcmp(u1, u2, sizeof(uuid_t)) == 0; } static inline void uuid_copy(uuid_t *dst, const uuid_t *src) { memcpy(dst, src, sizeof(uuid_t)); } static inline bool uuid_is_null(const uuid_t *uuid) { return uuid_equal(uuid, &uuid_null); } void generate_random_uuid(unsigned char uuid[16]); extern void guid_gen(guid_t *u); extern void uuid_gen(uuid_t *u); bool __must_check uuid_is_valid(const char *uuid); extern const u8 guid_index[16]; extern const u8 uuid_index[16]; int guid_parse(const char *uuid, guid_t *u); int uuid_parse(const char *uuid, uuid_t *u); /* backwards compatibility, don't use in new code */ #define uuid_le_gen(u) guid_gen(u) #define uuid_le_to_bin(guid, u) guid_parse(guid, u) static inline int uuid_le_cmp(const guid_t u1, const guid_t u2) { return memcmp(&u1, &u2, sizeof(guid_t)); } #endif # 96 "./include/linux/uuid.h" # 197 "drivers/gpu/drm/i915/i915_perf.c" 2 #if 0 /* expanded by -frewrite-includes */ #include "i915_drv.h" #endif /* expanded by -frewrite-includes */ # 198 "drivers/gpu/drm/i915/i915_perf.c" # 1 "drivers/gpu/drm/i915/i915_drv.h" 1 /* i915_drv.h -- Private header for the I915 driver -*- linux-c -*- */ /* * * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef _I915_DRV_H_ #define _I915_DRV_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "drivers/gpu/drm/i915/i915_drv.h" # 1 "./include/uapi/drm/i915_drm.h" 1 /* * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef _UAPI_I915_DRM_H_ #define _UAPI_I915_DRM_H_ #if 0 /* expanded by -frewrite-includes */ #include "drm.h" #endif /* expanded by -frewrite-includes */ # 30 "./include/uapi/drm/i915_drm.h" # 1 "./include/uapi/drm/drm.h" 1 /** * \file drm.h * Header for the Direct Rendering Manager * * \author Rickard E. (Rik) Faith * * \par Acknowledgments: * Dec 1999, Richard Henderson , move to generic \c cmpxchg. */ /* * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _DRM_H_ #define _DRM_H_ #if defined(__KERNEL__) #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "./include/uapi/drm/drm.h" # 42 "./include/uapi/drm/drm.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "./include/uapi/drm/drm.h" # 1 "./arch/x86/include/uapi/asm/ioctl.h" 1 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 1 "./arch/x86/include/uapi/asm/ioctl.h" # 1 "./include/asm-generic/ioctl.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_GENERIC_IOCTL_H #define _ASM_GENERIC_IOCTL_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/asm-generic/ioctl.h" # 1 "./include/uapi/asm-generic/ioctl.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UAPI_ASM_GENERIC_IOCTL_H #define _UAPI_ASM_GENERIC_IOCTL_H /* ioctl command encoding: 32 bits total, command in lower 16 bits, * size of the parameter structure in the lower 14 bits of the * upper 16 bits. * Encoding the size of the parameter structure in the ioctl request * is useful for catching programs compiled with old versions * and to avoid overwriting user space outside the user buffer area. * The highest 2 bits are reserved for indicating the ``access mode''. * NOTE: This limits the max parameter size to 16kB -1 ! */ /* * The following is for compatibility across the various Linux * platforms. The generic ioctl numbering scheme doesn't really enforce * a type field. De facto, however, the top 8 bits of the lower 16 * bits are indeed used as a type field, so we might just as well make * this explicit here. Please be sure to use the decoding macros * below from now on. */ #define _IOC_NRBITS 8 #define _IOC_TYPEBITS 8 /* * Let any architecture override either of the following before * including this file. */ #ifndef _IOC_SIZEBITS # define _IOC_SIZEBITS 14 #endif # 34 "./include/uapi/asm-generic/ioctl.h" #ifndef _IOC_DIRBITS # define _IOC_DIRBITS 2 #endif # 38 "./include/uapi/asm-generic/ioctl.h" #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) #define _IOC_NRSHIFT 0 #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) /* * Direction bits, which any architecture can choose to override * before including this file. * * NOTE: _IOC_WRITE means userland is writing and kernel is * reading. _IOC_READ means userland is reading and kernel is writing. */ #ifndef _IOC_NONE # define _IOC_NONE 0U #endif # 60 "./include/uapi/asm-generic/ioctl.h" #ifndef _IOC_WRITE # define _IOC_WRITE 1U #endif # 64 "./include/uapi/asm-generic/ioctl.h" #ifndef _IOC_READ # define _IOC_READ 2U #endif # 68 "./include/uapi/asm-generic/ioctl.h" #define _IOC(dir,type,nr,size) \ (((dir) << _IOC_DIRSHIFT) | \ ((type) << _IOC_TYPESHIFT) | \ ((nr) << _IOC_NRSHIFT) | \ ((size) << _IOC_SIZESHIFT)) #ifndef __KERNEL__ #define _IOC_TYPECHECK(t) (sizeof(t)) #endif # 78 "./include/uapi/asm-generic/ioctl.h" /* * Used to create numbers. * * NOTE: _IOW means userland is writing and kernel is reading. _IOR * means userland is reading and kernel is writing. */ #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) #define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) #define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) #define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) /* used to decode ioctl numbers.. */ #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) /* ...and for the drivers/sound files... */ #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) #endif /* _UAPI_ASM_GENERIC_IOCTL_H */ # 108 "./include/uapi/asm-generic/ioctl.h" # 6 "./include/asm-generic/ioctl.h" 2 #ifdef __CHECKER__ #define _IOC_TYPECHECK(t) (sizeof(t)) #else # 10 "./include/asm-generic/ioctl.h" /* provoke compile error for invalid uses of size argument */ extern unsigned int __invalid_size_argument_for_IOC; #define _IOC_TYPECHECK(t) \ ((sizeof(t) == sizeof(t[1]) && \ sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ sizeof(t) : __invalid_size_argument_for_IOC) #endif # 17 "./include/asm-generic/ioctl.h" #endif /* _ASM_GENERIC_IOCTL_H */ # 19 "./include/asm-generic/ioctl.h" # 2 "./arch/x86/include/uapi/asm/ioctl.h" 2 # 43 "./include/uapi/drm/drm.h" 2 typedef unsigned int drm_handle_t; #elif defined(__linux__) # 46 "./include/uapi/drm/drm.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 47 "./include/uapi/drm/drm.h" # 48 "./include/uapi/drm/drm.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 48 "./include/uapi/drm/drm.h" # 49 "./include/uapi/drm/drm.h" typedef unsigned int drm_handle_t; #else /* One of the BSDs */ # 52 "./include/uapi/drm/drm.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 53 "./include/uapi/drm/drm.h" # 54 "./include/uapi/drm/drm.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 54 "./include/uapi/drm/drm.h" # 55 "./include/uapi/drm/drm.h" typedef int8_t __s8; typedef uint8_t __u8; typedef int16_t __s16; typedef uint16_t __u16; typedef int32_t __s32; typedef uint32_t __u32; typedef int64_t __s64; typedef uint64_t __u64; typedef size_t __kernel_size_t; typedef unsigned long drm_handle_t; #endif # 67 "./include/uapi/drm/drm.h" #if defined(__cplusplus) extern "C" { #endif # 71 "./include/uapi/drm/drm.h" #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ #define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ #define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */ #define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */ #define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */ #define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD) #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) typedef unsigned int drm_context_t; typedef unsigned int drm_drawable_t; typedef unsigned int drm_magic_t; /** * Cliprect. * * \warning: If you change this structure, make sure you change * XF86DRIClipRectRec in the server as well * * \note KW: Actually it's illegal to change either for * backwards-compatibility reasons. */ struct drm_clip_rect { unsigned short x1; unsigned short y1; unsigned short x2; unsigned short y2; }; /** * Drawable information. */ struct drm_drawable_info { unsigned int num_rects; struct drm_clip_rect *rects; }; /** * Texture region, */ struct drm_tex_region { unsigned char next; unsigned char prev; unsigned char in_use; unsigned char padding; unsigned int age; }; /** * Hardware lock. * * The lock structure is a simple cache-line aligned integer. To avoid * processor bus contention on a multiprocessor system, there should not be any * other data stored in the same cache line. */ struct drm_hw_lock { __volatile__ unsigned int lock; /**< lock variable */ char padding[60]; /**< Pad to cache line */ }; /** * DRM_IOCTL_VERSION ioctl argument type. * * \sa drmGetVersion(). */ struct drm_version { int version_major; /**< Major version */ int version_minor; /**< Minor version */ int version_patchlevel; /**< Patch level */ __kernel_size_t name_len; /**< Length of name buffer */ char __user *name; /**< Name of driver */ __kernel_size_t date_len; /**< Length of date buffer */ char __user *date; /**< User-space buffer to hold date */ __kernel_size_t desc_len; /**< Length of desc buffer */ char __user *desc; /**< User-space buffer to hold desc */ }; /** * DRM_IOCTL_GET_UNIQUE ioctl argument type. * * \sa drmGetBusid() and drmSetBusId(). */ struct drm_unique { __kernel_size_t unique_len; /**< Length of unique */ char __user *unique; /**< Unique name for driver instantiation */ }; struct drm_list { int count; /**< Length of user-space structures */ struct drm_version __user *version; }; struct drm_block { int unused; }; /** * DRM_IOCTL_CONTROL ioctl argument type. * * \sa drmCtlInstHandler() and drmCtlUninstHandler(). */ struct drm_control { enum { DRM_ADD_COMMAND, DRM_RM_COMMAND, DRM_INST_HANDLER, DRM_UNINST_HANDLER } func; int irq; }; /** * Type of memory to map. */ enum drm_map_type { _DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */ _DRM_REGISTERS = 1, /**< no caching, no core dump */ _DRM_SHM = 2, /**< shared, cached */ _DRM_AGP = 3, /**< AGP/GART */ _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ _DRM_CONSISTENT = 5 /**< Consistent memory for PCI DMA */ }; /** * Memory mapping flags. */ enum drm_map_flags { _DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */ _DRM_READ_ONLY = 0x02, _DRM_LOCKED = 0x04, /**< shared, cached, locked */ _DRM_KERNEL = 0x08, /**< kernel requires access */ _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ _DRM_REMOVABLE = 0x40, /**< Removable mapping */ _DRM_DRIVER = 0x80 /**< Managed by driver */ }; struct drm_ctx_priv_map { unsigned int ctx_id; /**< Context requesting private mapping */ void *handle; /**< Handle of map */ }; /** * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls * argument type. * * \sa drmAddMap(). */ struct drm_map { unsigned long offset; /**< Requested physical address (0 for SAREA)*/ unsigned long size; /**< Requested physical size (bytes) */ enum drm_map_type type; /**< Type of memory to map */ enum drm_map_flags flags; /**< Flags */ void *handle; /**< User-space: "Handle" to pass to mmap() */ /**< Kernel-space: kernel-virtual address */ int mtrr; /**< MTRR slot used */ /* Private data */ }; /** * DRM_IOCTL_GET_CLIENT ioctl argument type. */ struct drm_client { int idx; /**< Which client desired? */ int auth; /**< Is client authenticated? */ unsigned long pid; /**< Process ID */ unsigned long uid; /**< User ID */ unsigned long magic; /**< Magic */ unsigned long iocs; /**< Ioctl count */ }; enum drm_stat_type { _DRM_STAT_LOCK, _DRM_STAT_OPENS, _DRM_STAT_CLOSES, _DRM_STAT_IOCTLS, _DRM_STAT_LOCKS, _DRM_STAT_UNLOCKS, _DRM_STAT_VALUE, /**< Generic value */ _DRM_STAT_BYTE, /**< Generic byte counter (1024bytes/K) */ _DRM_STAT_COUNT, /**< Generic non-byte counter (1000/k) */ _DRM_STAT_IRQ, /**< IRQ */ _DRM_STAT_PRIMARY, /**< Primary DMA bytes */ _DRM_STAT_SECONDARY, /**< Secondary DMA bytes */ _DRM_STAT_DMA, /**< DMA */ _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */ _DRM_STAT_MISSED /**< Missed DMA opportunity */ /* Add to the *END* of the list */ }; /** * DRM_IOCTL_GET_STATS ioctl argument type. */ struct drm_stats { unsigned long count; struct { unsigned long value; enum drm_stat_type type; } data[15]; }; /** * Hardware locking flags. */ enum drm_lock_flags { _DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */ _DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */ _DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */ _DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */ /* These *HALT* flags aren't supported yet -- they will be used to support the full-screen DGA-like mode. */ _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */ _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */ }; /** * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type. * * \sa drmGetLock() and drmUnlock(). */ struct drm_lock { int context; enum drm_lock_flags flags; }; /** * DMA flags * * \warning * These values \e must match xf86drm.h. * * \sa drm_dma. */ enum drm_dma_flags { /* Flags for DMA buffer dispatch */ _DRM_DMA_BLOCK = 0x01, /**< * Block until buffer dispatched. * * \note The buffer may not yet have * been processed by the hardware -- * getting a hardware lock with the * hardware quiescent will ensure * that the buffer has been * processed. */ _DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */ _DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */ /* Flags for DMA buffer request */ _DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */ _DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */ _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */ }; /** * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type. * * \sa drmAddBufs(). */ struct drm_buf_desc { int count; /**< Number of buffers of this size */ int size; /**< Size in bytes */ int low_mark; /**< Low water mark */ int high_mark; /**< High water mark */ enum { _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */ _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */ _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */ _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */ _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */ } flags; unsigned long agp_start; /**< * Start address of where the AGP buffers are * in the AGP aperture */ }; /** * DRM_IOCTL_INFO_BUFS ioctl argument type. */ struct drm_buf_info { int count; /**< Entries in list */ struct drm_buf_desc __user *list; }; /** * DRM_IOCTL_FREE_BUFS ioctl argument type. */ struct drm_buf_free { int count; int __user *list; }; /** * Buffer information * * \sa drm_buf_map. */ struct drm_buf_pub { int idx; /**< Index into the master buffer list */ int total; /**< Buffer size */ int used; /**< Amount of buffer in use (for DMA) */ void __user *address; /**< Address of buffer */ }; /** * DRM_IOCTL_MAP_BUFS ioctl argument type. */ struct drm_buf_map { int count; /**< Length of the buffer list */ #ifdef __cplusplus void __user *virt; #else # 389 "./include/uapi/drm/drm.h" void __user *virtual; /**< Mmap'd area in user-virtual */ #endif # 391 "./include/uapi/drm/drm.h" struct drm_buf_pub __user *list; /**< Buffer information */ }; /** * DRM_IOCTL_DMA ioctl argument type. * * Indices here refer to the offset into the buffer list in drm_buf_get. * * \sa drmDMA(). */ struct drm_dma { int context; /**< Context handle */ int send_count; /**< Number of buffers to send */ int __user *send_indices; /**< List of handles to buffers */ int __user *send_sizes; /**< Lengths of data to send */ enum drm_dma_flags flags; /**< Flags */ int request_count; /**< Number of buffers requested */ int request_size; /**< Desired size for buffers */ int __user *request_indices; /**< Buffer information */ int __user *request_sizes; int granted_count; /**< Number of buffers granted */ }; enum drm_ctx_flags { _DRM_CONTEXT_PRESERVED = 0x01, _DRM_CONTEXT_2DONLY = 0x02 }; /** * DRM_IOCTL_ADD_CTX ioctl argument type. * * \sa drmCreateContext() and drmDestroyContext(). */ struct drm_ctx { drm_context_t handle; enum drm_ctx_flags flags; }; /** * DRM_IOCTL_RES_CTX ioctl argument type. */ struct drm_ctx_res { int count; struct drm_ctx __user *contexts; }; /** * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type. */ struct drm_draw { drm_drawable_t handle; }; /** * DRM_IOCTL_UPDATE_DRAW ioctl argument type. */ typedef enum { DRM_DRAWABLE_CLIPRECTS } drm_drawable_info_type_t; struct drm_update_draw { drm_drawable_t handle; unsigned int type; unsigned int num; unsigned long long data; }; /** * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type. */ struct drm_auth { drm_magic_t magic; }; /** * DRM_IOCTL_IRQ_BUSID ioctl argument type. * * \sa drmGetInterruptFromBusID(). */ struct drm_irq_busid { int irq; /**< IRQ number */ int busnum; /**< bus number */ int devnum; /**< device number */ int funcnum; /**< function number */ }; enum drm_vblank_seq_type { _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ /* bits 1-6 are reserved for high crtcs */ _DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e, _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */ }; #define _DRM_VBLANK_HIGH_CRTC_SHIFT 1 #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS) struct drm_wait_vblank_request { enum drm_vblank_seq_type type; unsigned int sequence; unsigned long signal; }; struct drm_wait_vblank_reply { enum drm_vblank_seq_type type; unsigned int sequence; long tval_sec; long tval_usec; }; /** * DRM_IOCTL_WAIT_VBLANK ioctl argument type. * * \sa drmWaitVBlank(). */ union drm_wait_vblank { struct drm_wait_vblank_request request; struct drm_wait_vblank_reply reply; }; #define _DRM_PRE_MODESET 1 #define _DRM_POST_MODESET 2 /** * DRM_IOCTL_MODESET_CTL ioctl argument type * * \sa drmModesetCtl(). */ struct drm_modeset_ctl { __u32 crtc; __u32 cmd; }; /** * DRM_IOCTL_AGP_ENABLE ioctl argument type. * * \sa drmAgpEnable(). */ struct drm_agp_mode { unsigned long mode; /**< AGP mode */ }; /** * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type. * * \sa drmAgpAlloc() and drmAgpFree(). */ struct drm_agp_buffer { unsigned long size; /**< In bytes -- will round to page boundary */ unsigned long handle; /**< Used for binding / unbinding */ unsigned long type; /**< Type of memory to allocate */ unsigned long physical; /**< Physical used by i810 */ }; /** * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type. * * \sa drmAgpBind() and drmAgpUnbind(). */ struct drm_agp_binding { unsigned long handle; /**< From drm_agp_buffer */ unsigned long offset; /**< In bytes -- will round to page boundary */ }; /** * DRM_IOCTL_AGP_INFO ioctl argument type. * * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(), * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(), * drmAgpVendorId() and drmAgpDeviceId(). */ struct drm_agp_info { int agp_version_major; int agp_version_minor; unsigned long mode; unsigned long aperture_base; /* physical address */ unsigned long aperture_size; /* bytes */ unsigned long memory_allowed; /* bytes */ unsigned long memory_used; /* PCI information */ unsigned short id_vendor; unsigned short id_device; }; /** * DRM_IOCTL_SG_ALLOC ioctl argument type. */ struct drm_scatter_gather { unsigned long size; /**< In bytes -- will round to page boundary */ unsigned long handle; /**< Used for mapping / unmapping */ }; /** * DRM_IOCTL_SET_VERSION ioctl argument type. */ struct drm_set_version { int drm_di_major; int drm_di_minor; int drm_dd_major; int drm_dd_minor; }; /** DRM_IOCTL_GEM_CLOSE ioctl argument type */ struct drm_gem_close { /** Handle of the object to be closed. */ __u32 handle; __u32 pad; }; /** DRM_IOCTL_GEM_FLINK ioctl argument type */ struct drm_gem_flink { /** Handle for the object being named */ __u32 handle; /** Returned global name */ __u32 name; }; /** DRM_IOCTL_GEM_OPEN ioctl argument type */ struct drm_gem_open { /** Name of object being opened */ __u32 name; /** Returned handle for the object */ __u32 handle; /** Returned size of the object */ __u64 size; }; #define DRM_CAP_DUMB_BUFFER 0x1 #define DRM_CAP_VBLANK_HIGH_CRTC 0x2 #define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3 #define DRM_CAP_DUMB_PREFER_SHADOW 0x4 #define DRM_CAP_PRIME 0x5 #define DRM_PRIME_CAP_IMPORT 0x1 #define DRM_PRIME_CAP_EXPORT 0x2 #define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 #define DRM_CAP_ASYNC_PAGE_FLIP 0x7 /* * The CURSOR_WIDTH and CURSOR_HEIGHT capabilities return a valid widthxheight * combination for the hardware cursor. The intention is that a hardware * agnostic userspace can query a cursor plane size to use. * * Note that the cross-driver contract is to merely return a valid size; * drivers are free to attach another meaning on top, eg. i915 returns the * maximum plane size. */ #define DRM_CAP_CURSOR_WIDTH 0x8 #define DRM_CAP_CURSOR_HEIGHT 0x9 #define DRM_CAP_ADDFB2_MODIFIERS 0x10 #define DRM_CAP_PAGE_FLIP_TARGET 0x11 #define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 #define DRM_CAP_SYNCOBJ 0x13 /** DRM_IOCTL_GET_CAP ioctl argument type */ struct drm_get_cap { __u64 capability; __u64 value; }; /** * DRM_CLIENT_CAP_STEREO_3D * * if set to 1, the DRM core will expose the stereo 3D capabilities of the * monitor by advertising the supported 3D layouts in the flags of struct * drm_mode_modeinfo. */ #define DRM_CLIENT_CAP_STEREO_3D 1 /** * DRM_CLIENT_CAP_UNIVERSAL_PLANES * * If set to 1, the DRM core will expose all planes (overlay, primary, and * cursor) to userspace. */ #define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2 /** * DRM_CLIENT_CAP_ATOMIC * * If set to 1, the DRM core will expose atomic properties to userspace */ #define DRM_CLIENT_CAP_ATOMIC 3 /** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ struct drm_set_client_cap { __u64 capability; __u64 value; }; #define DRM_RDWR O_RDWR #define DRM_CLOEXEC O_CLOEXEC struct drm_prime_handle { __u32 handle; /** Flags.. only applicable for handle->fd */ __u32 flags; /** Returned dmabuf file descriptor */ __s32 fd; }; struct drm_syncobj_create { __u32 handle; #define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0) __u32 flags; }; struct drm_syncobj_destroy { __u32 handle; __u32 pad; }; #define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0) #define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0) struct drm_syncobj_handle { __u32 handle; __u32 flags; __s32 fd; __u32 pad; }; #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0) #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) struct drm_syncobj_wait { __u64 handles; /* absolute timeout */ __s64 timeout_nsec; __u32 count_handles; __u32 flags; __u32 first_signaled; /* only valid when not waiting all */ __u32 pad; }; struct drm_syncobj_array { __u64 handles; __u32 count_handles; __u32 pad; }; /* Query current scanout sequence number */ struct drm_crtc_get_sequence { __u32 crtc_id; /* requested crtc_id */ __u32 active; /* return: crtc output is active */ __u64 sequence; /* return: most recent vblank sequence */ __s64 sequence_ns; /* return: most recent time of first pixel out */ }; /* Queue event to be delivered at specified sequence. Time stamp marks * when the first pixel of the refresh cycle leaves the display engine * for the display */ #define DRM_CRTC_SEQUENCE_RELATIVE 0x00000001 /* sequence is relative to current */ #define DRM_CRTC_SEQUENCE_NEXT_ON_MISS 0x00000002 /* Use next sequence if we've missed */ struct drm_crtc_queue_sequence { __u32 crtc_id; __u32 flags; __u64 sequence; /* on input, target sequence. on output, actual sequence */ __u64 user_data; /* user data passed to event */ }; #if defined(__cplusplus) } #endif # 765 "./include/uapi/drm/drm.h" #if 0 /* expanded by -frewrite-includes */ #include "drm_mode.h" #endif /* expanded by -frewrite-includes */ # 766 "./include/uapi/drm/drm.h" # 1 "./include/uapi/drm/drm_mode.h" 1 /* * Copyright (c) 2007 Dave Airlie * Copyright (c) 2007 Jakob Bornecrantz * Copyright (c) 2008 Red Hat Inc. * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA * Copyright (c) 2007-2008 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #ifndef _DRM_MODE_H #define _DRM_MODE_H #if 0 /* expanded by -frewrite-includes */ #include "drm.h" #endif /* expanded by -frewrite-includes */ # 30 "./include/uapi/drm/drm_mode.h" # 1 "./include/uapi/drm/drm.h" 1 /** * \file drm.h * Header for the Direct Rendering Manager * * \author Rickard E. (Rik) Faith * * \par Acknowledgments: * Dec 1999, Richard Henderson , move to generic \c cmpxchg. */ /* * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _DRM_H_ #define _DRM_H_ #if defined(__KERNEL__) #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "./include/uapi/drm/drm.h" # 42 "./include/uapi/drm/drm.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "./include/uapi/drm/drm.h" # 43 "./include/uapi/drm/drm.h" typedef unsigned int drm_handle_t; #elif defined(__linux__) # 46 "./include/uapi/drm/drm.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 47 "./include/uapi/drm/drm.h" # 48 "./include/uapi/drm/drm.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 48 "./include/uapi/drm/drm.h" # 49 "./include/uapi/drm/drm.h" typedef unsigned int drm_handle_t; #else /* One of the BSDs */ # 52 "./include/uapi/drm/drm.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 53 "./include/uapi/drm/drm.h" # 54 "./include/uapi/drm/drm.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 54 "./include/uapi/drm/drm.h" # 55 "./include/uapi/drm/drm.h" typedef int8_t __s8; typedef uint8_t __u8; typedef int16_t __s16; typedef uint16_t __u16; typedef int32_t __s32; typedef uint32_t __u32; typedef int64_t __s64; typedef uint64_t __u64; typedef size_t __kernel_size_t; typedef unsigned long drm_handle_t; #endif # 67 "./include/uapi/drm/drm.h" #if defined(__cplusplus) extern "C" { #endif # 71 "./include/uapi/drm/drm.h" #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ #define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ #define DRM_RAM_PERCENT 10 /**< How much system ram can we lock? */ #define _DRM_LOCK_HELD 0x80000000U /**< Hardware lock is held */ #define _DRM_LOCK_CONT 0x40000000U /**< Hardware lock is contended */ #define _DRM_LOCK_IS_HELD(lock) ((lock) & _DRM_LOCK_HELD) #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) typedef unsigned int drm_context_t; typedef unsigned int drm_drawable_t; typedef unsigned int drm_magic_t; /** * Cliprect. * * \warning: If you change this structure, make sure you change * XF86DRIClipRectRec in the server as well * * \note KW: Actually it's illegal to change either for * backwards-compatibility reasons. */ struct drm_clip_rect { unsigned short x1; unsigned short y1; unsigned short x2; unsigned short y2; }; /** * Drawable information. */ struct drm_drawable_info { unsigned int num_rects; struct drm_clip_rect *rects; }; /** * Texture region, */ struct drm_tex_region { unsigned char next; unsigned char prev; unsigned char in_use; unsigned char padding; unsigned int age; }; /** * Hardware lock. * * The lock structure is a simple cache-line aligned integer. To avoid * processor bus contention on a multiprocessor system, there should not be any * other data stored in the same cache line. */ struct drm_hw_lock { __volatile__ unsigned int lock; /**< lock variable */ char padding[60]; /**< Pad to cache line */ }; /** * DRM_IOCTL_VERSION ioctl argument type. * * \sa drmGetVersion(). */ struct drm_version { int version_major; /**< Major version */ int version_minor; /**< Minor version */ int version_patchlevel; /**< Patch level */ __kernel_size_t name_len; /**< Length of name buffer */ char __user *name; /**< Name of driver */ __kernel_size_t date_len; /**< Length of date buffer */ char __user *date; /**< User-space buffer to hold date */ __kernel_size_t desc_len; /**< Length of desc buffer */ char __user *desc; /**< User-space buffer to hold desc */ }; /** * DRM_IOCTL_GET_UNIQUE ioctl argument type. * * \sa drmGetBusid() and drmSetBusId(). */ struct drm_unique { __kernel_size_t unique_len; /**< Length of unique */ char __user *unique; /**< Unique name for driver instantiation */ }; struct drm_list { int count; /**< Length of user-space structures */ struct drm_version __user *version; }; struct drm_block { int unused; }; /** * DRM_IOCTL_CONTROL ioctl argument type. * * \sa drmCtlInstHandler() and drmCtlUninstHandler(). */ struct drm_control { enum { DRM_ADD_COMMAND, DRM_RM_COMMAND, DRM_INST_HANDLER, DRM_UNINST_HANDLER } func; int irq; }; /** * Type of memory to map. */ enum drm_map_type { _DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */ _DRM_REGISTERS = 1, /**< no caching, no core dump */ _DRM_SHM = 2, /**< shared, cached */ _DRM_AGP = 3, /**< AGP/GART */ _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ _DRM_CONSISTENT = 5 /**< Consistent memory for PCI DMA */ }; /** * Memory mapping flags. */ enum drm_map_flags { _DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */ _DRM_READ_ONLY = 0x02, _DRM_LOCKED = 0x04, /**< shared, cached, locked */ _DRM_KERNEL = 0x08, /**< kernel requires access */ _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ _DRM_REMOVABLE = 0x40, /**< Removable mapping */ _DRM_DRIVER = 0x80 /**< Managed by driver */ }; struct drm_ctx_priv_map { unsigned int ctx_id; /**< Context requesting private mapping */ void *handle; /**< Handle of map */ }; /** * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls * argument type. * * \sa drmAddMap(). */ struct drm_map { unsigned long offset; /**< Requested physical address (0 for SAREA)*/ unsigned long size; /**< Requested physical size (bytes) */ enum drm_map_type type; /**< Type of memory to map */ enum drm_map_flags flags; /**< Flags */ void *handle; /**< User-space: "Handle" to pass to mmap() */ /**< Kernel-space: kernel-virtual address */ int mtrr; /**< MTRR slot used */ /* Private data */ }; /** * DRM_IOCTL_GET_CLIENT ioctl argument type. */ struct drm_client { int idx; /**< Which client desired? */ int auth; /**< Is client authenticated? */ unsigned long pid; /**< Process ID */ unsigned long uid; /**< User ID */ unsigned long magic; /**< Magic */ unsigned long iocs; /**< Ioctl count */ }; enum drm_stat_type { _DRM_STAT_LOCK, _DRM_STAT_OPENS, _DRM_STAT_CLOSES, _DRM_STAT_IOCTLS, _DRM_STAT_LOCKS, _DRM_STAT_UNLOCKS, _DRM_STAT_VALUE, /**< Generic value */ _DRM_STAT_BYTE, /**< Generic byte counter (1024bytes/K) */ _DRM_STAT_COUNT, /**< Generic non-byte counter (1000/k) */ _DRM_STAT_IRQ, /**< IRQ */ _DRM_STAT_PRIMARY, /**< Primary DMA bytes */ _DRM_STAT_SECONDARY, /**< Secondary DMA bytes */ _DRM_STAT_DMA, /**< DMA */ _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */ _DRM_STAT_MISSED /**< Missed DMA opportunity */ /* Add to the *END* of the list */ }; /** * DRM_IOCTL_GET_STATS ioctl argument type. */ struct drm_stats { unsigned long count; struct { unsigned long value; enum drm_stat_type type; } data[15]; }; /** * Hardware locking flags. */ enum drm_lock_flags { _DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */ _DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */ _DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */ _DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */ /* These *HALT* flags aren't supported yet -- they will be used to support the full-screen DGA-like mode. */ _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */ _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */ }; /** * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type. * * \sa drmGetLock() and drmUnlock(). */ struct drm_lock { int context; enum drm_lock_flags flags; }; /** * DMA flags * * \warning * These values \e must match xf86drm.h. * * \sa drm_dma. */ enum drm_dma_flags { /* Flags for DMA buffer dispatch */ _DRM_DMA_BLOCK = 0x01, /**< * Block until buffer dispatched. * * \note The buffer may not yet have * been processed by the hardware -- * getting a hardware lock with the * hardware quiescent will ensure * that the buffer has been * processed. */ _DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */ _DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */ /* Flags for DMA buffer request */ _DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */ _DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */ _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */ }; /** * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type. * * \sa drmAddBufs(). */ struct drm_buf_desc { int count; /**< Number of buffers of this size */ int size; /**< Size in bytes */ int low_mark; /**< Low water mark */ int high_mark; /**< High water mark */ enum { _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */ _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */ _DRM_SG_BUFFER = 0x04, /**< Scatter/gather memory buffer */ _DRM_FB_BUFFER = 0x08, /**< Buffer is in frame buffer */ _DRM_PCI_BUFFER_RO = 0x10 /**< Map PCI DMA buffer read-only */ } flags; unsigned long agp_start; /**< * Start address of where the AGP buffers are * in the AGP aperture */ }; /** * DRM_IOCTL_INFO_BUFS ioctl argument type. */ struct drm_buf_info { int count; /**< Entries in list */ struct drm_buf_desc __user *list; }; /** * DRM_IOCTL_FREE_BUFS ioctl argument type. */ struct drm_buf_free { int count; int __user *list; }; /** * Buffer information * * \sa drm_buf_map. */ struct drm_buf_pub { int idx; /**< Index into the master buffer list */ int total; /**< Buffer size */ int used; /**< Amount of buffer in use (for DMA) */ void __user *address; /**< Address of buffer */ }; /** * DRM_IOCTL_MAP_BUFS ioctl argument type. */ struct drm_buf_map { int count; /**< Length of the buffer list */ #ifdef __cplusplus void __user *virt; #else # 389 "./include/uapi/drm/drm.h" void __user *virtual; /**< Mmap'd area in user-virtual */ #endif # 391 "./include/uapi/drm/drm.h" struct drm_buf_pub __user *list; /**< Buffer information */ }; /** * DRM_IOCTL_DMA ioctl argument type. * * Indices here refer to the offset into the buffer list in drm_buf_get. * * \sa drmDMA(). */ struct drm_dma { int context; /**< Context handle */ int send_count; /**< Number of buffers to send */ int __user *send_indices; /**< List of handles to buffers */ int __user *send_sizes; /**< Lengths of data to send */ enum drm_dma_flags flags; /**< Flags */ int request_count; /**< Number of buffers requested */ int request_size; /**< Desired size for buffers */ int __user *request_indices; /**< Buffer information */ int __user *request_sizes; int granted_count; /**< Number of buffers granted */ }; enum drm_ctx_flags { _DRM_CONTEXT_PRESERVED = 0x01, _DRM_CONTEXT_2DONLY = 0x02 }; /** * DRM_IOCTL_ADD_CTX ioctl argument type. * * \sa drmCreateContext() and drmDestroyContext(). */ struct drm_ctx { drm_context_t handle; enum drm_ctx_flags flags; }; /** * DRM_IOCTL_RES_CTX ioctl argument type. */ struct drm_ctx_res { int count; struct drm_ctx __user *contexts; }; /** * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type. */ struct drm_draw { drm_drawable_t handle; }; /** * DRM_IOCTL_UPDATE_DRAW ioctl argument type. */ typedef enum { DRM_DRAWABLE_CLIPRECTS } drm_drawable_info_type_t; struct drm_update_draw { drm_drawable_t handle; unsigned int type; unsigned int num; unsigned long long data; }; /** * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type. */ struct drm_auth { drm_magic_t magic; }; /** * DRM_IOCTL_IRQ_BUSID ioctl argument type. * * \sa drmGetInterruptFromBusID(). */ struct drm_irq_busid { int irq; /**< IRQ number */ int busnum; /**< bus number */ int devnum; /**< device number */ int funcnum; /**< function number */ }; enum drm_vblank_seq_type { _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ /* bits 1-6 are reserved for high crtcs */ _DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e, _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */ }; #define _DRM_VBLANK_HIGH_CRTC_SHIFT 1 #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS) struct drm_wait_vblank_request { enum drm_vblank_seq_type type; unsigned int sequence; unsigned long signal; }; struct drm_wait_vblank_reply { enum drm_vblank_seq_type type; unsigned int sequence; long tval_sec; long tval_usec; }; /** * DRM_IOCTL_WAIT_VBLANK ioctl argument type. * * \sa drmWaitVBlank(). */ union drm_wait_vblank { struct drm_wait_vblank_request request; struct drm_wait_vblank_reply reply; }; #define _DRM_PRE_MODESET 1 #define _DRM_POST_MODESET 2 /** * DRM_IOCTL_MODESET_CTL ioctl argument type * * \sa drmModesetCtl(). */ struct drm_modeset_ctl { __u32 crtc; __u32 cmd; }; /** * DRM_IOCTL_AGP_ENABLE ioctl argument type. * * \sa drmAgpEnable(). */ struct drm_agp_mode { unsigned long mode; /**< AGP mode */ }; /** * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type. * * \sa drmAgpAlloc() and drmAgpFree(). */ struct drm_agp_buffer { unsigned long size; /**< In bytes -- will round to page boundary */ unsigned long handle; /**< Used for binding / unbinding */ unsigned long type; /**< Type of memory to allocate */ unsigned long physical; /**< Physical used by i810 */ }; /** * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type. * * \sa drmAgpBind() and drmAgpUnbind(). */ struct drm_agp_binding { unsigned long handle; /**< From drm_agp_buffer */ unsigned long offset; /**< In bytes -- will round to page boundary */ }; /** * DRM_IOCTL_AGP_INFO ioctl argument type. * * \sa drmAgpVersionMajor(), drmAgpVersionMinor(), drmAgpGetMode(), * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(), * drmAgpVendorId() and drmAgpDeviceId(). */ struct drm_agp_info { int agp_version_major; int agp_version_minor; unsigned long mode; unsigned long aperture_base; /* physical address */ unsigned long aperture_size; /* bytes */ unsigned long memory_allowed; /* bytes */ unsigned long memory_used; /* PCI information */ unsigned short id_vendor; unsigned short id_device; }; /** * DRM_IOCTL_SG_ALLOC ioctl argument type. */ struct drm_scatter_gather { unsigned long size; /**< In bytes -- will round to page boundary */ unsigned long handle; /**< Used for mapping / unmapping */ }; /** * DRM_IOCTL_SET_VERSION ioctl argument type. */ struct drm_set_version { int drm_di_major; int drm_di_minor; int drm_dd_major; int drm_dd_minor; }; /** DRM_IOCTL_GEM_CLOSE ioctl argument type */ struct drm_gem_close { /** Handle of the object to be closed. */ __u32 handle; __u32 pad; }; /** DRM_IOCTL_GEM_FLINK ioctl argument type */ struct drm_gem_flink { /** Handle for the object being named */ __u32 handle; /** Returned global name */ __u32 name; }; /** DRM_IOCTL_GEM_OPEN ioctl argument type */ struct drm_gem_open { /** Name of object being opened */ __u32 name; /** Returned handle for the object */ __u32 handle; /** Returned size of the object */ __u64 size; }; #define DRM_CAP_DUMB_BUFFER 0x1 #define DRM_CAP_VBLANK_HIGH_CRTC 0x2 #define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3 #define DRM_CAP_DUMB_PREFER_SHADOW 0x4 #define DRM_CAP_PRIME 0x5 #define DRM_PRIME_CAP_IMPORT 0x1 #define DRM_PRIME_CAP_EXPORT 0x2 #define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 #define DRM_CAP_ASYNC_PAGE_FLIP 0x7 /* * The CURSOR_WIDTH and CURSOR_HEIGHT capabilities return a valid widthxheight * combination for the hardware cursor. The intention is that a hardware * agnostic userspace can query a cursor plane size to use. * * Note that the cross-driver contract is to merely return a valid size; * drivers are free to attach another meaning on top, eg. i915 returns the * maximum plane size. */ #define DRM_CAP_CURSOR_WIDTH 0x8 #define DRM_CAP_CURSOR_HEIGHT 0x9 #define DRM_CAP_ADDFB2_MODIFIERS 0x10 #define DRM_CAP_PAGE_FLIP_TARGET 0x11 #define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 #define DRM_CAP_SYNCOBJ 0x13 /** DRM_IOCTL_GET_CAP ioctl argument type */ struct drm_get_cap { __u64 capability; __u64 value; }; /** * DRM_CLIENT_CAP_STEREO_3D * * if set to 1, the DRM core will expose the stereo 3D capabilities of the * monitor by advertising the supported 3D layouts in the flags of struct * drm_mode_modeinfo. */ #define DRM_CLIENT_CAP_STEREO_3D 1 /** * DRM_CLIENT_CAP_UNIVERSAL_PLANES * * If set to 1, the DRM core will expose all planes (overlay, primary, and * cursor) to userspace. */ #define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2 /** * DRM_CLIENT_CAP_ATOMIC * * If set to 1, the DRM core will expose atomic properties to userspace */ #define DRM_CLIENT_CAP_ATOMIC 3 /** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ struct drm_set_client_cap { __u64 capability; __u64 value; }; #define DRM_RDWR O_RDWR #define DRM_CLOEXEC O_CLOEXEC struct drm_prime_handle { __u32 handle; /** Flags.. only applicable for handle->fd */ __u32 flags; /** Returned dmabuf file descriptor */ __s32 fd; }; struct drm_syncobj_create { __u32 handle; #define DRM_SYNCOBJ_CREATE_SIGNALED (1 << 0) __u32 flags; }; struct drm_syncobj_destroy { __u32 handle; __u32 pad; }; #define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE (1 << 0) #define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE (1 << 0) struct drm_syncobj_handle { __u32 handle; __u32 flags; __s32 fd; __u32 pad; }; #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0) #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) struct drm_syncobj_wait { __u64 handles; /* absolute timeout */ __s64 timeout_nsec; __u32 count_handles; __u32 flags; __u32 first_signaled; /* only valid when not waiting all */ __u32 pad; }; struct drm_syncobj_array { __u64 handles; __u32 count_handles; __u32 pad; }; /* Query current scanout sequence number */ struct drm_crtc_get_sequence { __u32 crtc_id; /* requested crtc_id */ __u32 active; /* return: crtc output is active */ __u64 sequence; /* return: most recent vblank sequence */ __s64 sequence_ns; /* return: most recent time of first pixel out */ }; /* Queue event to be delivered at specified sequence. Time stamp marks * when the first pixel of the refresh cycle leaves the display engine * for the display */ #define DRM_CRTC_SEQUENCE_RELATIVE 0x00000001 /* sequence is relative to current */ #define DRM_CRTC_SEQUENCE_NEXT_ON_MISS 0x00000002 /* Use next sequence if we've missed */ struct drm_crtc_queue_sequence { __u32 crtc_id; __u32 flags; __u64 sequence; /* on input, target sequence. on output, actual sequence */ __u64 user_data; /* user data passed to event */ }; #if defined(__cplusplus) } #endif # 765 "./include/uapi/drm/drm.h" #if 0 /* expanded by -frewrite-includes */ #include "drm_mode.h" #endif /* expanded by -frewrite-includes */ # 766 "./include/uapi/drm/drm.h" # 767 "./include/uapi/drm/drm.h" #if defined(__cplusplus) extern "C" { #endif # 771 "./include/uapi/drm/drm.h" #define DRM_IOCTL_BASE 'd' #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) #define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) #define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type) #define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) #define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version) #define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique) #define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth) #define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid) #define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map) #define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) #define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) #define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl) #define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close) #define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) #define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) #define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap) #define DRM_IOCTL_SET_CLIENT_CAP DRM_IOW( 0x0d, struct drm_set_client_cap) #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) #define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block) #define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block) #define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control) #define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map) #define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc) #define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc) #define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info) #define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map) #define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free) #define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map) #define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map) #define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map) #define DRM_IOCTL_SET_MASTER DRM_IO(0x1e) #define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f) #define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx) #define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx) #define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx) #define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx) #define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx) #define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx) #define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res) #define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw) #define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw) #define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma) #define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock) #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) #define DRM_IOCTL_PRIME_HANDLE_TO_FD DRM_IOWR(0x2d, struct drm_prime_handle) #define DRM_IOCTL_PRIME_FD_TO_HANDLE DRM_IOWR(0x2e, struct drm_prime_handle) #define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) #define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) #define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode) #define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info) #define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer) #define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer) #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding) #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding) #define DRM_IOCTL_SG_ALLOC DRM_IOWR(0x38, struct drm_scatter_gather) #define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather) #define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank) #define DRM_IOCTL_CRTC_GET_SEQUENCE DRM_IOWR(0x3b, struct drm_crtc_get_sequence) #define DRM_IOCTL_CRTC_QUEUE_SEQUENCE DRM_IOWR(0x3c, struct drm_crtc_queue_sequence) #define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw) #define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) #define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc) #define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc) #define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor) #define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut) #define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) #define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) #define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) #define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */ #define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */ #define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) #define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) #define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob) #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) #define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) #define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) #define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) #define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) #define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) #define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res) #define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane) #define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane) #define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) #define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties) #define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property) #define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2) #define DRM_IOCTL_MODE_ATOMIC DRM_IOWR(0xBC, struct drm_mode_atomic) #define DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, struct drm_mode_create_blob) #define DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, struct drm_mode_destroy_blob) #define DRM_IOCTL_SYNCOBJ_CREATE DRM_IOWR(0xBF, struct drm_syncobj_create) #define DRM_IOCTL_SYNCOBJ_DESTROY DRM_IOWR(0xC0, struct drm_syncobj_destroy) #define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle) #define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle) #define DRM_IOCTL_SYNCOBJ_WAIT DRM_IOWR(0xC3, struct drm_syncobj_wait) #define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array) #define DRM_IOCTL_SYNCOBJ_SIGNAL DRM_IOWR(0xC5, struct drm_syncobj_array) #define DRM_IOCTL_MODE_CREATE_LEASE DRM_IOWR(0xC6, struct drm_mode_create_lease) #define DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct drm_mode_list_lessees) #define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease) #define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) /** * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f. * Generic IOCTLS restart at 0xA0. * * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and * drmCommandReadWrite(). */ #define DRM_COMMAND_BASE 0x40 #define DRM_COMMAND_END 0xA0 /** * Header for events written back to userspace on the drm fd. The * type defines the type of event, the length specifies the total * length of the event (including the header), and user_data is * typically a 64 bit value passed with the ioctl that triggered the * event. A read on the drm fd will always only return complete * events, that is, if for example the read buffer is 100 bytes, and * there are two 64 byte events pending, only one will be returned. * * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and * up are chipset specific. */ struct drm_event { __u32 type; __u32 length; }; #define DRM_EVENT_VBLANK 0x01 #define DRM_EVENT_FLIP_COMPLETE 0x02 #define DRM_EVENT_CRTC_SEQUENCE 0x03 struct drm_event_vblank { struct drm_event base; __u64 user_data; __u32 tv_sec; __u32 tv_usec; __u32 sequence; __u32 crtc_id; /* 0 on older kernels that do not support this */ }; /* Event delivered at sequence. Time stamp marks when the first pixel * of the refresh cycle leaves the display engine for the display */ struct drm_event_crtc_sequence { struct drm_event base; __u64 user_data; __s64 time_ns; __u64 sequence; }; /* typedef area */ #ifndef __KERNEL__ typedef struct drm_clip_rect drm_clip_rect_t; typedef struct drm_drawable_info drm_drawable_info_t; typedef struct drm_tex_region drm_tex_region_t; typedef struct drm_hw_lock drm_hw_lock_t; typedef struct drm_version drm_version_t; typedef struct drm_unique drm_unique_t; typedef struct drm_list drm_list_t; typedef struct drm_block drm_block_t; typedef struct drm_control drm_control_t; typedef enum drm_map_type drm_map_type_t; typedef enum drm_map_flags drm_map_flags_t; typedef struct drm_ctx_priv_map drm_ctx_priv_map_t; typedef struct drm_map drm_map_t; typedef struct drm_client drm_client_t; typedef enum drm_stat_type drm_stat_type_t; typedef struct drm_stats drm_stats_t; typedef enum drm_lock_flags drm_lock_flags_t; typedef struct drm_lock drm_lock_t; typedef enum drm_dma_flags drm_dma_flags_t; typedef struct drm_buf_desc drm_buf_desc_t; typedef struct drm_buf_info drm_buf_info_t; typedef struct drm_buf_free drm_buf_free_t; typedef struct drm_buf_pub drm_buf_pub_t; typedef struct drm_buf_map drm_buf_map_t; typedef struct drm_dma drm_dma_t; typedef union drm_wait_vblank drm_wait_vblank_t; typedef struct drm_agp_mode drm_agp_mode_t; typedef enum drm_ctx_flags drm_ctx_flags_t; typedef struct drm_ctx drm_ctx_t; typedef struct drm_ctx_res drm_ctx_res_t; typedef struct drm_draw drm_draw_t; typedef struct drm_update_draw drm_update_draw_t; typedef struct drm_auth drm_auth_t; typedef struct drm_irq_busid drm_irq_busid_t; typedef enum drm_vblank_seq_type drm_vblank_seq_type_t; typedef struct drm_agp_buffer drm_agp_buffer_t; typedef struct drm_agp_binding drm_agp_binding_t; typedef struct drm_agp_info drm_agp_info_t; typedef struct drm_scatter_gather drm_scatter_gather_t; typedef struct drm_set_version drm_set_version_t; #endif # 991 "./include/uapi/drm/drm.h" #if defined(__cplusplus) } #endif # 995 "./include/uapi/drm/drm.h" #endif # 997 "./include/uapi/drm/drm.h" # 31 "./include/uapi/drm/drm_mode.h" 2 #if defined(__cplusplus) extern "C" { #endif # 35 "./include/uapi/drm/drm_mode.h" #define DRM_DISPLAY_INFO_LEN 32 #define DRM_CONNECTOR_NAME_LEN 32 #define DRM_DISPLAY_MODE_LEN 32 #define DRM_PROP_NAME_LEN 32 #define DRM_MODE_TYPE_BUILTIN (1<<0) #define DRM_MODE_TYPE_CLOCK_C ((1<<1) | DRM_MODE_TYPE_BUILTIN) #define DRM_MODE_TYPE_CRTC_C ((1<<2) | DRM_MODE_TYPE_BUILTIN) #define DRM_MODE_TYPE_PREFERRED (1<<3) #define DRM_MODE_TYPE_DEFAULT (1<<4) #define DRM_MODE_TYPE_USERDEF (1<<5) #define DRM_MODE_TYPE_DRIVER (1<<6) /* Video mode flags */ /* bit compatible with the xrandr RR_ definitions (bits 0-13) * * ABI warning: Existing userspace really expects * the mode flags to match the xrandr definitions. Any * changes that don't match the xrandr definitions will * likely need a new client cap or some other mechanism * to avoid breaking existing userspace. This includes * allocating new flags in the previously unused bits! */ #define DRM_MODE_FLAG_PHSYNC (1<<0) #define DRM_MODE_FLAG_NHSYNC (1<<1) #define DRM_MODE_FLAG_PVSYNC (1<<2) #define DRM_MODE_FLAG_NVSYNC (1<<3) #define DRM_MODE_FLAG_INTERLACE (1<<4) #define DRM_MODE_FLAG_DBLSCAN (1<<5) #define DRM_MODE_FLAG_CSYNC (1<<6) #define DRM_MODE_FLAG_PCSYNC (1<<7) #define DRM_MODE_FLAG_NCSYNC (1<<8) #define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */ #define DRM_MODE_FLAG_BCAST (1<<10) #define DRM_MODE_FLAG_PIXMUX (1<<11) #define DRM_MODE_FLAG_DBLCLK (1<<12) #define DRM_MODE_FLAG_CLKDIV2 (1<<13) /* * When adding a new stereo mode don't forget to adjust DRM_MODE_FLAGS_3D_MAX * (define not exposed to user space). */ #define DRM_MODE_FLAG_3D_MASK (0x1f<<14) #define DRM_MODE_FLAG_3D_NONE (0<<14) #define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<14) #define DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE (2<<14) #define DRM_MODE_FLAG_3D_LINE_ALTERNATIVE (3<<14) #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL (4<<14) #define DRM_MODE_FLAG_3D_L_DEPTH (5<<14) #define DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH (6<<14) #define DRM_MODE_FLAG_3D_TOP_AND_BOTTOM (7<<14) #define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF (8<<14) /* Picture aspect ratio options */ #define DRM_MODE_PICTURE_ASPECT_NONE 0 #define DRM_MODE_PICTURE_ASPECT_4_3 1 #define DRM_MODE_PICTURE_ASPECT_16_9 2 /* Aspect ratio flag bitmask (4 bits 22:19) */ #define DRM_MODE_FLAG_PIC_AR_MASK (0x0F<<19) #define DRM_MODE_FLAG_PIC_AR_NONE \ (DRM_MODE_PICTURE_ASPECT_NONE<<19) #define DRM_MODE_FLAG_PIC_AR_4_3 \ (DRM_MODE_PICTURE_ASPECT_4_3<<19) #define DRM_MODE_FLAG_PIC_AR_16_9 \ (DRM_MODE_PICTURE_ASPECT_16_9<<19) /* DPMS flags */ /* bit compatible with the xorg definitions. */ #define DRM_MODE_DPMS_ON 0 #define DRM_MODE_DPMS_STANDBY 1 #define DRM_MODE_DPMS_SUSPEND 2 #define DRM_MODE_DPMS_OFF 3 /* Scaling mode options */ #define DRM_MODE_SCALE_NONE 0 /* Unmodified timing (display or software can still scale) */ #define DRM_MODE_SCALE_FULLSCREEN 1 /* Full screen, ignore aspect */ #define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */ #define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */ /* Dithering mode options */ #define DRM_MODE_DITHERING_OFF 0 #define DRM_MODE_DITHERING_ON 1 #define DRM_MODE_DITHERING_AUTO 2 /* Dirty info options */ #define DRM_MODE_DIRTY_OFF 0 #define DRM_MODE_DIRTY_ON 1 #define DRM_MODE_DIRTY_ANNOTATE 2 /* Link Status options */ #define DRM_MODE_LINK_STATUS_GOOD 0 #define DRM_MODE_LINK_STATUS_BAD 1 /* * DRM_MODE_ROTATE_ * * Signals that a drm plane is been rotated degrees in counter * clockwise direction. * * This define is provided as a convenience, looking up the property id * using the name->prop id lookup is the preferred method. */ #define DRM_MODE_ROTATE_0 (1<<0) #define DRM_MODE_ROTATE_90 (1<<1) #define DRM_MODE_ROTATE_180 (1<<2) #define DRM_MODE_ROTATE_270 (1<<3) /* * DRM_MODE_ROTATE_MASK * * Bitmask used to look for drm plane rotations. */ #define DRM_MODE_ROTATE_MASK (\ DRM_MODE_ROTATE_0 | \ DRM_MODE_ROTATE_90 | \ DRM_MODE_ROTATE_180 | \ DRM_MODE_ROTATE_270) /* * DRM_MODE_REFLECT_ * * Signals that the contents of a drm plane is reflected in the axis, * in the same way as mirroring. * * This define is provided as a convenience, looking up the property id * using the name->prop id lookup is the preferred method. */ #define DRM_MODE_REFLECT_X (1<<4) #define DRM_MODE_REFLECT_Y (1<<5) /* * DRM_MODE_REFLECT_MASK * * Bitmask used to look for drm plane reflections. */ #define DRM_MODE_REFLECT_MASK (\ DRM_MODE_REFLECT_X | \ DRM_MODE_REFLECT_Y) struct drm_mode_modeinfo { __u32 clock; __u16 hdisplay; __u16 hsync_start; __u16 hsync_end; __u16 htotal; __u16 hskew; __u16 vdisplay; __u16 vsync_start; __u16 vsync_end; __u16 vtotal; __u16 vscan; __u32 vrefresh; __u32 flags; __u32 type; char name[DRM_DISPLAY_MODE_LEN]; }; struct drm_mode_card_res { __u64 fb_id_ptr; __u64 crtc_id_ptr; __u64 connector_id_ptr; __u64 encoder_id_ptr; __u32 count_fbs; __u32 count_crtcs; __u32 count_connectors; __u32 count_encoders; __u32 min_width; __u32 max_width; __u32 min_height; __u32 max_height; }; struct drm_mode_crtc { __u64 set_connectors_ptr; __u32 count_connectors; __u32 crtc_id; /**< Id */ __u32 fb_id; /**< Id of framebuffer */ __u32 x; /**< x Position on the framebuffer */ __u32 y; /**< y Position on the framebuffer */ __u32 gamma_size; __u32 mode_valid; struct drm_mode_modeinfo mode; }; #define DRM_MODE_PRESENT_TOP_FIELD (1<<0) #define DRM_MODE_PRESENT_BOTTOM_FIELD (1<<1) /* Planes blend with or override other bits on the CRTC */ struct drm_mode_set_plane { __u32 plane_id; __u32 crtc_id; __u32 fb_id; /* fb object contains surface format type */ __u32 flags; /* see above flags */ /* Signed dest location allows it to be partially off screen */ __s32 crtc_x; __s32 crtc_y; __u32 crtc_w; __u32 crtc_h; /* Source values are 16.16 fixed point */ __u32 src_x; __u32 src_y; __u32 src_h; __u32 src_w; }; struct drm_mode_get_plane { __u32 plane_id; __u32 crtc_id; __u32 fb_id; __u32 possible_crtcs; __u32 gamma_size; __u32 count_format_types; __u64 format_type_ptr; }; struct drm_mode_get_plane_res { __u64 plane_id_ptr; __u32 count_planes; }; #define DRM_MODE_ENCODER_NONE 0 #define DRM_MODE_ENCODER_DAC 1 #define DRM_MODE_ENCODER_TMDS 2 #define DRM_MODE_ENCODER_LVDS 3 #define DRM_MODE_ENCODER_TVDAC 4 #define DRM_MODE_ENCODER_VIRTUAL 5 #define DRM_MODE_ENCODER_DSI 6 #define DRM_MODE_ENCODER_DPMST 7 #define DRM_MODE_ENCODER_DPI 8 struct drm_mode_get_encoder { __u32 encoder_id; __u32 encoder_type; __u32 crtc_id; /**< Id of crtc */ __u32 possible_crtcs; __u32 possible_clones; }; /* This is for connectors with multiple signal types. */ /* Try to match DRM_MODE_CONNECTOR_X as closely as possible. */ enum drm_mode_subconnector { DRM_MODE_SUBCONNECTOR_Automatic = 0, DRM_MODE_SUBCONNECTOR_Unknown = 0, DRM_MODE_SUBCONNECTOR_DVID = 3, DRM_MODE_SUBCONNECTOR_DVIA = 4, DRM_MODE_SUBCONNECTOR_Composite = 5, DRM_MODE_SUBCONNECTOR_SVIDEO = 6, DRM_MODE_SUBCONNECTOR_Component = 8, DRM_MODE_SUBCONNECTOR_SCART = 9, }; #define DRM_MODE_CONNECTOR_Unknown 0 #define DRM_MODE_CONNECTOR_VGA 1 #define DRM_MODE_CONNECTOR_DVII 2 #define DRM_MODE_CONNECTOR_DVID 3 #define DRM_MODE_CONNECTOR_DVIA 4 #define DRM_MODE_CONNECTOR_Composite 5 #define DRM_MODE_CONNECTOR_SVIDEO 6 #define DRM_MODE_CONNECTOR_LVDS 7 #define DRM_MODE_CONNECTOR_Component 8 #define DRM_MODE_CONNECTOR_9PinDIN 9 #define DRM_MODE_CONNECTOR_DisplayPort 10 #define DRM_MODE_CONNECTOR_HDMIA 11 #define DRM_MODE_CONNECTOR_HDMIB 12 #define DRM_MODE_CONNECTOR_TV 13 #define DRM_MODE_CONNECTOR_eDP 14 #define DRM_MODE_CONNECTOR_VIRTUAL 15 #define DRM_MODE_CONNECTOR_DSI 16 #define DRM_MODE_CONNECTOR_DPI 17 struct drm_mode_get_connector { __u64 encoders_ptr; __u64 modes_ptr; __u64 props_ptr; __u64 prop_values_ptr; __u32 count_modes; __u32 count_props; __u32 count_encoders; __u32 encoder_id; /**< Current Encoder */ __u32 connector_id; /**< Id */ __u32 connector_type; __u32 connector_type_id; __u32 connection; __u32 mm_width; /**< width in millimeters */ __u32 mm_height; /**< height in millimeters */ __u32 subpixel; __u32 pad; }; #define DRM_MODE_PROP_PENDING (1<<0) #define DRM_MODE_PROP_RANGE (1<<1) #define DRM_MODE_PROP_IMMUTABLE (1<<2) #define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */ #define DRM_MODE_PROP_BLOB (1<<4) #define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */ /* non-extended types: legacy bitmask, one bit per type: */ #define DRM_MODE_PROP_LEGACY_TYPE ( \ DRM_MODE_PROP_RANGE | \ DRM_MODE_PROP_ENUM | \ DRM_MODE_PROP_BLOB | \ DRM_MODE_PROP_BITMASK) /* extended-types: rather than continue to consume a bit per type, * grab a chunk of the bits to use as integer type id. */ #define DRM_MODE_PROP_EXTENDED_TYPE 0x0000ffc0 #define DRM_MODE_PROP_TYPE(n) ((n) << 6) #define DRM_MODE_PROP_OBJECT DRM_MODE_PROP_TYPE(1) #define DRM_MODE_PROP_SIGNED_RANGE DRM_MODE_PROP_TYPE(2) /* the PROP_ATOMIC flag is used to hide properties from userspace that * is not aware of atomic properties. This is mostly to work around * older userspace (DDX drivers) that read/write each prop they find, * witout being aware that this could be triggering a lengthy modeset. */ #define DRM_MODE_PROP_ATOMIC 0x80000000 struct drm_mode_property_enum { __u64 value; char name[DRM_PROP_NAME_LEN]; }; struct drm_mode_get_property { __u64 values_ptr; /* values and blob lengths */ __u64 enum_blob_ptr; /* enum and blob id ptrs */ __u32 prop_id; __u32 flags; char name[DRM_PROP_NAME_LEN]; __u32 count_values; /* This is only used to count enum values, not blobs. The _blobs is * simply because of a historical reason, i.e. backwards compat. */ __u32 count_enum_blobs; }; struct drm_mode_connector_set_property { __u64 value; __u32 prop_id; __u32 connector_id; }; #define DRM_MODE_OBJECT_CRTC 0xcccccccc #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 #define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0 #define DRM_MODE_OBJECT_MODE 0xdededede #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0 #define DRM_MODE_OBJECT_FB 0xfbfbfbfb #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee #define DRM_MODE_OBJECT_ANY 0 struct drm_mode_obj_get_properties { __u64 props_ptr; __u64 prop_values_ptr; __u32 count_props; __u32 obj_id; __u32 obj_type; }; struct drm_mode_obj_set_property { __u64 value; __u32 prop_id; __u32 obj_id; __u32 obj_type; }; struct drm_mode_get_blob { __u32 blob_id; __u32 length; __u64 data; }; struct drm_mode_fb_cmd { __u32 fb_id; __u32 width; __u32 height; __u32 pitch; __u32 bpp; __u32 depth; /* driver specific handle */ __u32 handle; }; #define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */ #define DRM_MODE_FB_MODIFIERS (1<<1) /* enables ->modifer[] */ struct drm_mode_fb_cmd2 { __u32 fb_id; __u32 width; __u32 height; __u32 pixel_format; /* fourcc code from drm_fourcc.h */ __u32 flags; /* see above flags */ /* * In case of planar formats, this ioctl allows up to 4 * buffer objects with offsets and pitches per plane. * The pitch and offset order is dictated by the fourcc, * e.g. NV12 (http://fourcc.org/yuv.php#NV12) is described as: * * YUV 4:2:0 image with a plane of 8 bit Y samples * followed by an interleaved U/V plane containing * 8 bit 2x2 subsampled colour difference samples. * * So it would consist of Y as offsets[0] and UV as * offsets[1]. Note that offsets[0] will generally * be 0 (but this is not required). * * To accommodate tiled, compressed, etc formats, a * modifier can be specified. The default value of zero * indicates "native" format as specified by the fourcc. * Vendor specific modifier token. Note that even though * it looks like we have a modifier per-plane, we in fact * do not. The modifier for each plane must be identical. * Thus all combinations of different data layouts for * multi plane formats must be enumerated as separate * modifiers. */ __u32 handles[4]; __u32 pitches[4]; /* pitch for each plane */ __u32 offsets[4]; /* offset of each plane */ __u64 modifier[4]; /* ie, tiling, compress */ }; #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01 #define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02 #define DRM_MODE_FB_DIRTY_FLAGS 0x03 #define DRM_MODE_FB_DIRTY_MAX_CLIPS 256 /* * Mark a region of a framebuffer as dirty. * * Some hardware does not automatically update display contents * as a hardware or software draw to a framebuffer. This ioctl * allows userspace to tell the kernel and the hardware what * regions of the framebuffer have changed. * * The kernel or hardware is free to update more then just the * region specified by the clip rects. The kernel or hardware * may also delay and/or coalesce several calls to dirty into a * single update. * * Userspace may annotate the updates, the annotates are a * promise made by the caller that the change is either a copy * of pixels or a fill of a single color in the region specified. * * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then * the number of updated regions are half of num_clips given, * where the clip rects are paired in src and dst. The width and * height of each one of the pairs must match. * * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller * promises that the region specified of the clip rects is filled * completely with a single color as given in the color argument. */ struct drm_mode_fb_dirty_cmd { __u32 fb_id; __u32 flags; __u32 color; __u32 num_clips; __u64 clips_ptr; }; struct drm_mode_mode_cmd { __u32 connector_id; struct drm_mode_modeinfo mode; }; #define DRM_MODE_CURSOR_BO 0x01 #define DRM_MODE_CURSOR_MOVE 0x02 #define DRM_MODE_CURSOR_FLAGS 0x03 /* * depending on the value in flags different members are used. * * CURSOR_BO uses * crtc_id * width * height * handle - if 0 turns the cursor off * * CURSOR_MOVE uses * crtc_id * x * y */ struct drm_mode_cursor { __u32 flags; __u32 crtc_id; __s32 x; __s32 y; __u32 width; __u32 height; /* driver specific handle */ __u32 handle; }; struct drm_mode_cursor2 { __u32 flags; __u32 crtc_id; __s32 x; __s32 y; __u32 width; __u32 height; /* driver specific handle */ __u32 handle; __s32 hot_x; __s32 hot_y; }; struct drm_mode_crtc_lut { __u32 crtc_id; __u32 gamma_size; /* pointers to arrays */ __u64 red; __u64 green; __u64 blue; }; struct drm_color_ctm { /* Conversion matrix in S31.32 format. */ __s64 matrix[9]; }; struct drm_color_lut { /* * Data is U0.16 fixed point format. */ __u16 red; __u16 green; __u16 blue; __u16 reserved; }; #define DRM_MODE_PAGE_FLIP_EVENT 0x01 #define DRM_MODE_PAGE_FLIP_ASYNC 0x02 #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4 #define DRM_MODE_PAGE_FLIP_TARGET_RELATIVE 0x8 #define DRM_MODE_PAGE_FLIP_TARGET (DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE | \ DRM_MODE_PAGE_FLIP_TARGET_RELATIVE) #define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \ DRM_MODE_PAGE_FLIP_ASYNC | \ DRM_MODE_PAGE_FLIP_TARGET) /* * Request a page flip on the specified crtc. * * This ioctl will ask KMS to schedule a page flip for the specified * crtc. Once any pending rendering targeting the specified fb (as of * ioctl time) has completed, the crtc will be reprogrammed to display * that fb after the next vertical refresh. The ioctl returns * immediately, but subsequent rendering to the current fb will block * in the execbuffer ioctl until the page flip happens. If a page * flip is already pending as the ioctl is called, EBUSY will be * returned. * * Flag DRM_MODE_PAGE_FLIP_EVENT requests that drm sends back a vblank * event (see drm.h: struct drm_event_vblank) when the page flip is * done. The user_data field passed in with this ioctl will be * returned as the user_data field in the vblank event struct. * * Flag DRM_MODE_PAGE_FLIP_ASYNC requests that the flip happen * 'as soon as possible', meaning that it not delay waiting for vblank. * This may cause tearing on the screen. * * The reserved field must be zero. */ struct drm_mode_crtc_page_flip { __u32 crtc_id; __u32 fb_id; __u32 flags; __u32 reserved; __u64 user_data; }; /* * Request a page flip on the specified crtc. * * Same as struct drm_mode_crtc_page_flip, but supports new flags and * re-purposes the reserved field: * * The sequence field must be zero unless either of the * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is specified. When * the ABSOLUTE flag is specified, the sequence field denotes the absolute * vblank sequence when the flip should take effect. When the RELATIVE * flag is specified, the sequence field denotes the relative (to the * current one when the ioctl is called) vblank sequence when the flip * should take effect. NOTE: DRM_IOCTL_WAIT_VBLANK must still be used to * make sure the vblank sequence before the target one has passed before * calling this ioctl. The purpose of the * DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags is merely to clarify * the target for when code dealing with a page flip runs during a * vertical blank period. */ struct drm_mode_crtc_page_flip_target { __u32 crtc_id; __u32 fb_id; __u32 flags; __u32 sequence; __u64 user_data; }; /* create a dumb scanout buffer */ struct drm_mode_create_dumb { __u32 height; __u32 width; __u32 bpp; __u32 flags; /* handle, pitch, size will be returned */ __u32 handle; __u32 pitch; __u64 size; }; /* set up for mmap of a dumb scanout buffer */ struct drm_mode_map_dumb { /** Handle for the object being mapped. */ __u32 handle; __u32 pad; /** * Fake offset to use for subsequent mmap call * * This is a fixed-size type for 32/64 compatibility. */ __u64 offset; }; struct drm_mode_destroy_dumb { __u32 handle; }; /* page-flip flags are valid, plus: */ #define DRM_MODE_ATOMIC_TEST_ONLY 0x0100 #define DRM_MODE_ATOMIC_NONBLOCK 0x0200 #define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400 #define DRM_MODE_ATOMIC_FLAGS (\ DRM_MODE_PAGE_FLIP_EVENT |\ DRM_MODE_PAGE_FLIP_ASYNC |\ DRM_MODE_ATOMIC_TEST_ONLY |\ DRM_MODE_ATOMIC_NONBLOCK |\ DRM_MODE_ATOMIC_ALLOW_MODESET) struct drm_mode_atomic { __u32 flags; __u32 count_objs; __u64 objs_ptr; __u64 count_props_ptr; __u64 props_ptr; __u64 prop_values_ptr; __u64 reserved; __u64 user_data; }; struct drm_format_modifier_blob { #define FORMAT_BLOB_CURRENT 1 /* Version of this blob format */ __u32 version; /* Flags */ __u32 flags; /* Number of fourcc formats supported */ __u32 count_formats; /* Where in this blob the formats exist (in bytes) */ __u32 formats_offset; /* Number of drm_format_modifiers */ __u32 count_modifiers; /* Where in this blob the modifiers exist (in bytes) */ __u32 modifiers_offset; /* __u32 formats[] */ /* struct drm_format_modifier modifiers[] */ }; struct drm_format_modifier { /* Bitmask of formats in get_plane format list this info applies to. The * offset allows a sliding window of which 64 formats (bits). * * Some examples: * In today's world with < 65 formats, and formats 0, and 2 are * supported * 0x0000000000000005 * ^-offset = 0, formats = 5 * * If the number formats grew to 128, and formats 98-102 are * supported with the modifier: * * 0x0000007c00000000 0000000000000000 * ^ * |__offset = 64, formats = 0x7c00000000 * */ __u64 formats; __u32 offset; __u32 pad; /* The modifier that applies to the >get_plane format list bitmask. */ __u64 modifier; }; /** * Create a new 'blob' data property, copying length bytes from data pointer, * and returning new blob ID. */ struct drm_mode_create_blob { /** Pointer to data to copy. */ __u64 data; /** Length of data to copy. */ __u32 length; /** Return: new property ID. */ __u32 blob_id; }; /** * Destroy a user-created blob property. */ struct drm_mode_destroy_blob { __u32 blob_id; }; /** * Lease mode resources, creating another drm_master. */ struct drm_mode_create_lease { /** Pointer to array of object ids (__u32) */ __u64 object_ids; /** Number of object ids */ __u32 object_count; /** flags for new FD (O_CLOEXEC, etc) */ __u32 flags; /** Return: unique identifier for lessee. */ __u32 lessee_id; /** Return: file descriptor to new drm_master file */ __u32 fd; }; /** * List lesses from a drm_master */ struct drm_mode_list_lessees { /** Number of lessees. * On input, provides length of the array. * On output, provides total number. No * more than the input number will be written * back, so two calls can be used to get * the size and then the data. */ __u32 count_lessees; __u32 pad; /** Pointer to lessees. * pointer to __u64 array of lessee ids */ __u64 lessees_ptr; }; /** * Get leased objects */ struct drm_mode_get_lease { /** Number of leased objects. * On input, provides length of the array. * On output, provides total number. No * more than the input number will be written * back, so two calls can be used to get * the size and then the data. */ __u32 count_objects; __u32 pad; /** Pointer to objects. * pointer to __u32 array of object ids */ __u64 objects_ptr; }; /** * Revoke lease */ struct drm_mode_revoke_lease { /** Unique ID of lessee */ __u32 lessee_id; }; #if defined(__cplusplus) } #endif # 854 "./include/uapi/drm/drm_mode.h" #endif # 856 "./include/uapi/drm/drm_mode.h" # 767 "./include/uapi/drm/drm.h" 2 #if defined(__cplusplus) extern "C" { #endif # 771 "./include/uapi/drm/drm.h" #define DRM_IOCTL_BASE 'd' #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) #define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) #define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type) #define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) #define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version) #define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique) #define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth) #define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid) #define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map) #define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) #define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) #define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl) #define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close) #define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) #define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) #define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap) #define DRM_IOCTL_SET_CLIENT_CAP DRM_IOW( 0x0d, struct drm_set_client_cap) #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) #define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block) #define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block) #define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control) #define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map) #define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc) #define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc) #define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info) #define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map) #define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free) #define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map) #define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map) #define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map) #define DRM_IOCTL_SET_MASTER DRM_IO(0x1e) #define DRM_IOCTL_DROP_MASTER DRM_IO(0x1f) #define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx) #define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx) #define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx) #define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx) #define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx) #define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx) #define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res) #define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw) #define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw) #define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma) #define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock) #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) #define DRM_IOCTL_PRIME_HANDLE_TO_FD DRM_IOWR(0x2d, struct drm_prime_handle) #define DRM_IOCTL_PRIME_FD_TO_HANDLE DRM_IOWR(0x2e, struct drm_prime_handle) #define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) #define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) #define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode) #define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info) #define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer) #define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer) #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding) #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding) #define DRM_IOCTL_SG_ALLOC DRM_IOWR(0x38, struct drm_scatter_gather) #define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather) #define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank) #define DRM_IOCTL_CRTC_GET_SEQUENCE DRM_IOWR(0x3b, struct drm_crtc_get_sequence) #define DRM_IOCTL_CRTC_QUEUE_SEQUENCE DRM_IOWR(0x3c, struct drm_crtc_queue_sequence) #define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw) #define DRM_IOCTL_MODE_GETRESOURCES DRM_IOWR(0xA0, struct drm_mode_card_res) #define DRM_IOCTL_MODE_GETCRTC DRM_IOWR(0xA1, struct drm_mode_crtc) #define DRM_IOCTL_MODE_SETCRTC DRM_IOWR(0xA2, struct drm_mode_crtc) #define DRM_IOCTL_MODE_CURSOR DRM_IOWR(0xA3, struct drm_mode_cursor) #define DRM_IOCTL_MODE_GETGAMMA DRM_IOWR(0xA4, struct drm_mode_crtc_lut) #define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) #define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) #define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) #define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */ #define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */ #define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) #define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) #define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob) #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) #define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) #define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) #define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) #define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) #define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) #define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res) #define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane) #define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane) #define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) #define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties) #define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property) #define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2) #define DRM_IOCTL_MODE_ATOMIC DRM_IOWR(0xBC, struct drm_mode_atomic) #define DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, struct drm_mode_create_blob) #define DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, struct drm_mode_destroy_blob) #define DRM_IOCTL_SYNCOBJ_CREATE DRM_IOWR(0xBF, struct drm_syncobj_create) #define DRM_IOCTL_SYNCOBJ_DESTROY DRM_IOWR(0xC0, struct drm_syncobj_destroy) #define DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD DRM_IOWR(0xC1, struct drm_syncobj_handle) #define DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE DRM_IOWR(0xC2, struct drm_syncobj_handle) #define DRM_IOCTL_SYNCOBJ_WAIT DRM_IOWR(0xC3, struct drm_syncobj_wait) #define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array) #define DRM_IOCTL_SYNCOBJ_SIGNAL DRM_IOWR(0xC5, struct drm_syncobj_array) #define DRM_IOCTL_MODE_CREATE_LEASE DRM_IOWR(0xC6, struct drm_mode_create_lease) #define DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct drm_mode_list_lessees) #define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease) #define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) /** * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f. * Generic IOCTLS restart at 0xA0. * * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and * drmCommandReadWrite(). */ #define DRM_COMMAND_BASE 0x40 #define DRM_COMMAND_END 0xA0 /** * Header for events written back to userspace on the drm fd. The * type defines the type of event, the length specifies the total * length of the event (including the header), and user_data is * typically a 64 bit value passed with the ioctl that triggered the * event. A read on the drm fd will always only return complete * events, that is, if for example the read buffer is 100 bytes, and * there are two 64 byte events pending, only one will be returned. * * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and * up are chipset specific. */ struct drm_event { __u32 type; __u32 length; }; #define DRM_EVENT_VBLANK 0x01 #define DRM_EVENT_FLIP_COMPLETE 0x02 #define DRM_EVENT_CRTC_SEQUENCE 0x03 struct drm_event_vblank { struct drm_event base; __u64 user_data; __u32 tv_sec; __u32 tv_usec; __u32 sequence; __u32 crtc_id; /* 0 on older kernels that do not support this */ }; /* Event delivered at sequence. Time stamp marks when the first pixel * of the refresh cycle leaves the display engine for the display */ struct drm_event_crtc_sequence { struct drm_event base; __u64 user_data; __s64 time_ns; __u64 sequence; }; /* typedef area */ #ifndef __KERNEL__ typedef struct drm_clip_rect drm_clip_rect_t; typedef struct drm_drawable_info drm_drawable_info_t; typedef struct drm_tex_region drm_tex_region_t; typedef struct drm_hw_lock drm_hw_lock_t; typedef struct drm_version drm_version_t; typedef struct drm_unique drm_unique_t; typedef struct drm_list drm_list_t; typedef struct drm_block drm_block_t; typedef struct drm_control drm_control_t; typedef enum drm_map_type drm_map_type_t; typedef enum drm_map_flags drm_map_flags_t; typedef struct drm_ctx_priv_map drm_ctx_priv_map_t; typedef struct drm_map drm_map_t; typedef struct drm_client drm_client_t; typedef enum drm_stat_type drm_stat_type_t; typedef struct drm_stats drm_stats_t; typedef enum drm_lock_flags drm_lock_flags_t; typedef struct drm_lock drm_lock_t; typedef enum drm_dma_flags drm_dma_flags_t; typedef struct drm_buf_desc drm_buf_desc_t; typedef struct drm_buf_info drm_buf_info_t; typedef struct drm_buf_free drm_buf_free_t; typedef struct drm_buf_pub drm_buf_pub_t; typedef struct drm_buf_map drm_buf_map_t; typedef struct drm_dma drm_dma_t; typedef union drm_wait_vblank drm_wait_vblank_t; typedef struct drm_agp_mode drm_agp_mode_t; typedef enum drm_ctx_flags drm_ctx_flags_t; typedef struct drm_ctx drm_ctx_t; typedef struct drm_ctx_res drm_ctx_res_t; typedef struct drm_draw drm_draw_t; typedef struct drm_update_draw drm_update_draw_t; typedef struct drm_auth drm_auth_t; typedef struct drm_irq_busid drm_irq_busid_t; typedef enum drm_vblank_seq_type drm_vblank_seq_type_t; typedef struct drm_agp_buffer drm_agp_buffer_t; typedef struct drm_agp_binding drm_agp_binding_t; typedef struct drm_agp_info drm_agp_info_t; typedef struct drm_scatter_gather drm_scatter_gather_t; typedef struct drm_set_version drm_set_version_t; #endif # 991 "./include/uapi/drm/drm.h" #if defined(__cplusplus) } #endif # 995 "./include/uapi/drm/drm.h" #endif # 997 "./include/uapi/drm/drm.h" # 31 "./include/uapi/drm/i915_drm.h" 2 #if defined(__cplusplus) extern "C" { #endif # 35 "./include/uapi/drm/i915_drm.h" /* Please note that modifications to all structs defined here are * subject to backwards-compatibility constraints. */ /** * DOC: uevents generated by i915 on it's device node * * I915_L3_PARITY_UEVENT - Generated when the driver receives a parity mismatch * event from the gpu l3 cache. Additional information supplied is ROW, * BANK, SUBBANK, SLICE of the affected cacheline. Userspace should keep * track of these events and if a specific cache-line seems to have a * persistent error remap it with the l3 remapping tool supplied in * intel-gpu-tools. The value supplied with the event is always 1. * * I915_ERROR_UEVENT - Generated upon error detection, currently only via * hangcheck. The error detection event is a good indicator of when things * began to go badly. The value supplied with the event is a 1 upon error * detection, and a 0 upon reset completion, signifying no more error * exists. NOTE: Disabling hangcheck or reset via module parameter will * cause the related events to not be seen. * * I915_RESET_UEVENT - Event is generated just before an attempt to reset the * the GPU. The value supplied with the event is always 1. NOTE: Disable * reset via module parameter will cause this event to not be seen. */ #define I915_L3_PARITY_UEVENT "L3_PARITY_ERROR" #define I915_ERROR_UEVENT "ERROR" #define I915_RESET_UEVENT "RESET" /* * MOCS indexes used for GPU surfaces, defining the cacheability of the * surface data and the coherency for this data wrt. CPU vs. GPU accesses. */ enum i915_mocs_table_index { /* * Not cached anywhere, coherency between CPU and GPU accesses is * guaranteed. */ I915_MOCS_UNCACHED, /* * Cacheability and coherency controlled by the kernel automatically * based on the DRM_I915_GEM_SET_CACHING IOCTL setting and the current * usage of the surface (used for display scanout or not). */ I915_MOCS_PTE, /* * Cached in all GPU caches available on the platform. * Coherency between CPU and GPU accesses to the surface is not * guaranteed without extra synchronization. */ I915_MOCS_CACHED, }; /* Each region is a minimum of 16k, and there are at most 255 of them. */ #define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use * of chars for next/prev indices */ #define I915_LOG_MIN_TEX_REGION_SIZE 14 typedef struct _drm_i915_init { enum { I915_INIT_DMA = 0x01, I915_CLEANUP_DMA = 0x02, I915_RESUME_DMA = 0x03 } func; unsigned int mmio_offset; int sarea_priv_offset; unsigned int ring_start; unsigned int ring_end; unsigned int ring_size; unsigned int front_offset; unsigned int back_offset; unsigned int depth_offset; unsigned int w; unsigned int h; unsigned int pitch; unsigned int pitch_bits; unsigned int back_pitch; unsigned int depth_pitch; unsigned int cpp; unsigned int chipset; } drm_i915_init_t; typedef struct _drm_i915_sarea { struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1]; int last_upload; /* last time texture was uploaded */ int last_enqueue; /* last time a buffer was enqueued */ int last_dispatch; /* age of the most recently dispatched buffer */ int ctxOwner; /* last context to upload state */ int texAge; int pf_enabled; /* is pageflipping allowed? */ int pf_active; int pf_current_page; /* which buffer is being displayed? */ int perf_boxes; /* performance boxes to be displayed */ int width, height; /* screen size in pixels */ drm_handle_t front_handle; int front_offset; int front_size; drm_handle_t back_handle; int back_offset; int back_size; drm_handle_t depth_handle; int depth_offset; int depth_size; drm_handle_t tex_handle; int tex_offset; int tex_size; int log_tex_granularity; int pitch; int rotation; /* 0, 90, 180 or 270 */ int rotated_offset; int rotated_size; int rotated_pitch; int virtualX, virtualY; unsigned int front_tiled; unsigned int back_tiled; unsigned int depth_tiled; unsigned int rotated_tiled; unsigned int rotated2_tiled; int pipeA_x; int pipeA_y; int pipeA_w; int pipeA_h; int pipeB_x; int pipeB_y; int pipeB_w; int pipeB_h; /* fill out some space for old userspace triple buffer */ drm_handle_t unused_handle; __u32 unused1, unused2, unused3; /* buffer object handles for static buffers. May change * over the lifetime of the client. */ __u32 front_bo_handle; __u32 back_bo_handle; __u32 unused_bo_handle; __u32 depth_bo_handle; } drm_i915_sarea_t; /* due to userspace building against these headers we need some compat here */ #define planeA_x pipeA_x #define planeA_y pipeA_y #define planeA_w pipeA_w #define planeA_h pipeA_h #define planeB_x pipeB_x #define planeB_y pipeB_y #define planeB_w pipeB_w #define planeB_h pipeB_h /* Flags for perf_boxes */ #define I915_BOX_RING_EMPTY 0x1 #define I915_BOX_FLIP 0x2 #define I915_BOX_WAIT 0x4 #define I915_BOX_TEXTURE_LOAD 0x8 #define I915_BOX_LOST_CONTEXT 0x10 /* * i915 specific ioctls. * * The device specific ioctl range is [DRM_COMMAND_BASE, DRM_COMMAND_END) ie * [0x40, 0xa0) (a0 is excluded). The numbers below are defined as offset * against DRM_COMMAND_BASE and should be between [0x0, 0x60). */ #define DRM_I915_INIT 0x00 #define DRM_I915_FLUSH 0x01 #define DRM_I915_FLIP 0x02 #define DRM_I915_BATCHBUFFER 0x03 #define DRM_I915_IRQ_EMIT 0x04 #define DRM_I915_IRQ_WAIT 0x05 #define DRM_I915_GETPARAM 0x06 #define DRM_I915_SETPARAM 0x07 #define DRM_I915_ALLOC 0x08 #define DRM_I915_FREE 0x09 #define DRM_I915_INIT_HEAP 0x0a #define DRM_I915_CMDBUFFER 0x0b #define DRM_I915_DESTROY_HEAP 0x0c #define DRM_I915_SET_VBLANK_PIPE 0x0d #define DRM_I915_GET_VBLANK_PIPE 0x0e #define DRM_I915_VBLANK_SWAP 0x0f #define DRM_I915_HWS_ADDR 0x11 #define DRM_I915_GEM_INIT 0x13 #define DRM_I915_GEM_EXECBUFFER 0x14 #define DRM_I915_GEM_PIN 0x15 #define DRM_I915_GEM_UNPIN 0x16 #define DRM_I915_GEM_BUSY 0x17 #define DRM_I915_GEM_THROTTLE 0x18 #define DRM_I915_GEM_ENTERVT 0x19 #define DRM_I915_GEM_LEAVEVT 0x1a #define DRM_I915_GEM_CREATE 0x1b #define DRM_I915_GEM_PREAD 0x1c #define DRM_I915_GEM_PWRITE 0x1d #define DRM_I915_GEM_MMAP 0x1e #define DRM_I915_GEM_SET_DOMAIN 0x1f #define DRM_I915_GEM_SW_FINISH 0x20 #define DRM_I915_GEM_SET_TILING 0x21 #define DRM_I915_GEM_GET_TILING 0x22 #define DRM_I915_GEM_GET_APERTURE 0x23 #define DRM_I915_GEM_MMAP_GTT 0x24 #define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25 #define DRM_I915_GEM_MADVISE 0x26 #define DRM_I915_OVERLAY_PUT_IMAGE 0x27 #define DRM_I915_OVERLAY_ATTRS 0x28 #define DRM_I915_GEM_EXECBUFFER2 0x29 #define DRM_I915_GEM_EXECBUFFER2_WR DRM_I915_GEM_EXECBUFFER2 #define DRM_I915_GET_SPRITE_COLORKEY 0x2a #define DRM_I915_SET_SPRITE_COLORKEY 0x2b #define DRM_I915_GEM_WAIT 0x2c #define DRM_I915_GEM_CONTEXT_CREATE 0x2d #define DRM_I915_GEM_CONTEXT_DESTROY 0x2e #define DRM_I915_GEM_SET_CACHING 0x2f #define DRM_I915_GEM_GET_CACHING 0x30 #define DRM_I915_REG_READ 0x31 #define DRM_I915_GET_RESET_STATS 0x32 #define DRM_I915_GEM_USERPTR 0x33 #define DRM_I915_GEM_CONTEXT_GETPARAM 0x34 #define DRM_I915_GEM_CONTEXT_SETPARAM 0x35 #define DRM_I915_PERF_OPEN 0x36 #define DRM_I915_PERF_ADD_CONFIG 0x37 #define DRM_I915_PERF_REMOVE_CONFIG 0x38 #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) #define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP) #define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t) #define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t) #define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t) #define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t) #define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t) #define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t) #define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t) #define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t) #define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t) #define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t) #define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t) #define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) #define DRM_IOCTL_I915_HWS_ADDR DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init) #define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) #define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) #define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2) #define DRM_IOCTL_I915_GEM_EXECBUFFER2_WR DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2_WR, struct drm_i915_gem_execbuffer2) #define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) #define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) #define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) #define DRM_IOCTL_I915_GEM_SET_CACHING DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_CACHING, struct drm_i915_gem_caching) #define DRM_IOCTL_I915_GEM_GET_CACHING DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_GET_CACHING, struct drm_i915_gem_caching) #define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE) #define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT) #define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT) #define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create) #define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread) #define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite) #define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap) #define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt) #define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain) #define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish) #define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) #define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling) #define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture) #define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id) #define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) #define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image) #define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) #define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) #define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) #define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait) #define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create) #define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy) #define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read) #define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats) #define DRM_IOCTL_I915_GEM_USERPTR DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_USERPTR, struct drm_i915_gem_userptr) #define DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_GETPARAM, struct drm_i915_gem_context_param) #define DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_SETPARAM, struct drm_i915_gem_context_param) #define DRM_IOCTL_I915_PERF_OPEN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_OPEN, struct drm_i915_perf_open_param) #define DRM_IOCTL_I915_PERF_ADD_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_ADD_CONFIG, struct drm_i915_perf_oa_config) #define DRM_IOCTL_I915_PERF_REMOVE_CONFIG DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_REMOVE_CONFIG, __u64) /* Allow drivers to submit batchbuffers directly to hardware, relying * on the security mechanisms provided by hardware. */ typedef struct drm_i915_batchbuffer { int start; /* agp offset */ int used; /* nr bytes in use */ int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ int num_cliprects; /* mulitpass with multiple cliprects? */ struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */ } drm_i915_batchbuffer_t; /* As above, but pass a pointer to userspace buffer which can be * validated by the kernel prior to sending to hardware. */ typedef struct _drm_i915_cmdbuffer { char __user *buf; /* pointer to userspace command buffer */ int sz; /* nr bytes in buf */ int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ int num_cliprects; /* mulitpass with multiple cliprects? */ struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */ } drm_i915_cmdbuffer_t; /* Userspace can request & wait on irq's: */ typedef struct drm_i915_irq_emit { int __user *irq_seq; } drm_i915_irq_emit_t; typedef struct drm_i915_irq_wait { int irq_seq; } drm_i915_irq_wait_t; /* Ioctl to query kernel params: */ #define I915_PARAM_IRQ_ACTIVE 1 #define I915_PARAM_ALLOW_BATCHBUFFER 2 #define I915_PARAM_LAST_DISPATCH 3 #define I915_PARAM_CHIPSET_ID 4 #define I915_PARAM_HAS_GEM 5 #define I915_PARAM_NUM_FENCES_AVAIL 6 #define I915_PARAM_HAS_OVERLAY 7 #define I915_PARAM_HAS_PAGEFLIPPING 8 #define I915_PARAM_HAS_EXECBUF2 9 #define I915_PARAM_HAS_BSD 10 #define I915_PARAM_HAS_BLT 11 #define I915_PARAM_HAS_RELAXED_FENCING 12 #define I915_PARAM_HAS_COHERENT_RINGS 13 #define I915_PARAM_HAS_EXEC_CONSTANTS 14 #define I915_PARAM_HAS_RELAXED_DELTA 15 #define I915_PARAM_HAS_GEN7_SOL_RESET 16 #define I915_PARAM_HAS_LLC 17 #define I915_PARAM_HAS_ALIASING_PPGTT 18 #define I915_PARAM_HAS_WAIT_TIMEOUT 19 #define I915_PARAM_HAS_SEMAPHORES 20 #define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21 #define I915_PARAM_HAS_VEBOX 22 #define I915_PARAM_HAS_SECURE_BATCHES 23 #define I915_PARAM_HAS_PINNED_BATCHES 24 #define I915_PARAM_HAS_EXEC_NO_RELOC 25 #define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 #define I915_PARAM_HAS_WT 27 #define I915_PARAM_CMD_PARSER_VERSION 28 #define I915_PARAM_HAS_COHERENT_PHYS_GTT 29 #define I915_PARAM_MMAP_VERSION 30 #define I915_PARAM_HAS_BSD2 31 #define I915_PARAM_REVISION 32 #define I915_PARAM_SUBSLICE_TOTAL 33 #define I915_PARAM_EU_TOTAL 34 #define I915_PARAM_HAS_GPU_RESET 35 #define I915_PARAM_HAS_RESOURCE_STREAMER 36 #define I915_PARAM_HAS_EXEC_SOFTPIN 37 #define I915_PARAM_HAS_POOLED_EU 38 #define I915_PARAM_MIN_EU_IN_POOL 39 #define I915_PARAM_MMAP_GTT_VERSION 40 /* * Query whether DRM_I915_GEM_EXECBUFFER2 supports user defined execution * priorities and the driver will attempt to execute batches in priority order. * The param returns a capability bitmask, nonzero implies that the scheduler * is enabled, with different features present according to the mask. * * The initial priority for each batch is supplied by the context and is * controlled via I915_CONTEXT_PARAM_PRIORITY. */ #define I915_PARAM_HAS_SCHEDULER 41 #define I915_SCHEDULER_CAP_ENABLED (1ul << 0) #define I915_SCHEDULER_CAP_PRIORITY (1ul << 1) #define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2) #define I915_PARAM_HUC_STATUS 42 /* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to opt-out of * synchronisation with implicit fencing on individual objects. * See EXEC_OBJECT_ASYNC. */ #define I915_PARAM_HAS_EXEC_ASYNC 43 /* Query whether DRM_I915_GEM_EXECBUFFER2 supports explicit fence support - * both being able to pass in a sync_file fd to wait upon before executing, * and being able to return a new sync_file fd that is signaled when the * current request is complete. See I915_EXEC_FENCE_IN and I915_EXEC_FENCE_OUT. */ #define I915_PARAM_HAS_EXEC_FENCE 44 /* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to capture * user specified bufffers for post-mortem debugging of GPU hangs. See * EXEC_OBJECT_CAPTURE. */ #define I915_PARAM_HAS_EXEC_CAPTURE 45 #define I915_PARAM_SLICE_MASK 46 /* Assuming it's uniform for each slice, this queries the mask of subslices * per-slice for this system. */ #define I915_PARAM_SUBSLICE_MASK 47 /* * Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying the batch buffer * as the first execobject as opposed to the last. See I915_EXEC_BATCH_FIRST. */ #define I915_PARAM_HAS_EXEC_BATCH_FIRST 48 /* Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying an array of * drm_i915_gem_exec_fence structures. See I915_EXEC_FENCE_ARRAY. */ #define I915_PARAM_HAS_EXEC_FENCE_ARRAY 49 typedef struct drm_i915_getparam { __s32 param; /* * WARNING: Using pointers instead of fixed-size u64 means we need to write * compat32 code. Don't repeat this mistake. */ int __user *value; } drm_i915_getparam_t; /* Ioctl to set kernel params: */ #define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1 #define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2 #define I915_SETPARAM_ALLOW_BATCHBUFFER 3 #define I915_SETPARAM_NUM_USED_FENCES 4 typedef struct drm_i915_setparam { int param; int value; } drm_i915_setparam_t; /* A memory manager for regions of shared memory: */ #define I915_MEM_REGION_AGP 1 typedef struct drm_i915_mem_alloc { int region; int alignment; int size; int __user *region_offset; /* offset from start of fb or agp */ } drm_i915_mem_alloc_t; typedef struct drm_i915_mem_free { int region; int region_offset; } drm_i915_mem_free_t; typedef struct drm_i915_mem_init_heap { int region; int size; int start; } drm_i915_mem_init_heap_t; /* Allow memory manager to be torn down and re-initialized (eg on * rotate): */ typedef struct drm_i915_mem_destroy_heap { int region; } drm_i915_mem_destroy_heap_t; /* Allow X server to configure which pipes to monitor for vblank signals */ #define DRM_I915_VBLANK_PIPE_A 1 #define DRM_I915_VBLANK_PIPE_B 2 typedef struct drm_i915_vblank_pipe { int pipe; } drm_i915_vblank_pipe_t; /* Schedule buffer swap at given vertical blank: */ typedef struct drm_i915_vblank_swap { drm_drawable_t drawable; enum drm_vblank_seq_type seqtype; unsigned int sequence; } drm_i915_vblank_swap_t; typedef struct drm_i915_hws_addr { __u64 addr; } drm_i915_hws_addr_t; struct drm_i915_gem_init { /** * Beginning offset in the GTT to be managed by the DRM memory * manager. */ __u64 gtt_start; /** * Ending offset in the GTT to be managed by the DRM memory * manager. */ __u64 gtt_end; }; struct drm_i915_gem_create { /** * Requested size for the object. * * The (page-aligned) allocated size for the object will be returned. */ __u64 size; /** * Returned handle for the object. * * Object handles are nonzero. */ __u32 handle; __u32 pad; }; struct drm_i915_gem_pread { /** Handle for the object being read. */ __u32 handle; __u32 pad; /** Offset into the object to read from */ __u64 offset; /** Length of data to read */ __u64 size; /** * Pointer to write the data into. * * This is a fixed-size type for 32/64 compatibility. */ __u64 data_ptr; }; struct drm_i915_gem_pwrite { /** Handle for the object being written to. */ __u32 handle; __u32 pad; /** Offset into the object to write to */ __u64 offset; /** Length of data to write */ __u64 size; /** * Pointer to read the data from. * * This is a fixed-size type for 32/64 compatibility. */ __u64 data_ptr; }; struct drm_i915_gem_mmap { /** Handle for the object being mapped. */ __u32 handle; __u32 pad; /** Offset in the object to map. */ __u64 offset; /** * Length of data to map. * * The value will be page-aligned. */ __u64 size; /** * Returned pointer the data was mapped at. * * This is a fixed-size type for 32/64 compatibility. */ __u64 addr_ptr; /** * Flags for extended behaviour. * * Added in version 2. */ __u64 flags; #define I915_MMAP_WC 0x1 }; struct drm_i915_gem_mmap_gtt { /** Handle for the object being mapped. */ __u32 handle; __u32 pad; /** * Fake offset to use for subsequent mmap call * * This is a fixed-size type for 32/64 compatibility. */ __u64 offset; }; struct drm_i915_gem_set_domain { /** Handle for the object */ __u32 handle; /** New read domains */ __u32 read_domains; /** New write domain */ __u32 write_domain; }; struct drm_i915_gem_sw_finish { /** Handle for the object */ __u32 handle; }; struct drm_i915_gem_relocation_entry { /** * Handle of the buffer being pointed to by this relocation entry. * * It's appealing to make this be an index into the mm_validate_entry * list to refer to the buffer, but this allows the driver to create * a relocation list for state buffers and not re-write it per * exec using the buffer. */ __u32 target_handle; /** * Value to be added to the offset of the target buffer to make up * the relocation entry. */ __u32 delta; /** Offset in the buffer the relocation entry will be written into */ __u64 offset; /** * Offset value of the target buffer that the relocation entry was last * written as. * * If the buffer has the same offset as last time, we can skip syncing * and writing the relocation. This value is written back out by * the execbuffer ioctl when the relocation is written. */ __u64 presumed_offset; /** * Target memory domains read by this operation. */ __u32 read_domains; /** * Target memory domains written by this operation. * * Note that only one domain may be written by the whole * execbuffer operation, so that where there are conflicts, * the application will get -EINVAL back. */ __u32 write_domain; }; /** @{ * Intel memory domains * * Most of these just align with the various caches in * the system and are used to flush and invalidate as * objects end up cached in different domains. */ /** CPU cache */ #define I915_GEM_DOMAIN_CPU 0x00000001 /** Render cache, used by 2D and 3D drawing */ #define I915_GEM_DOMAIN_RENDER 0x00000002 /** Sampler cache, used by texture engine */ #define I915_GEM_DOMAIN_SAMPLER 0x00000004 /** Command queue, used to load batch buffers */ #define I915_GEM_DOMAIN_COMMAND 0x00000008 /** Instruction cache, used by shader programs */ #define I915_GEM_DOMAIN_INSTRUCTION 0x00000010 /** Vertex address cache */ #define I915_GEM_DOMAIN_VERTEX 0x00000020 /** GTT domain - aperture and scanout */ #define I915_GEM_DOMAIN_GTT 0x00000040 /** WC domain - uncached access */ #define I915_GEM_DOMAIN_WC 0x00000080 /** @} */ struct drm_i915_gem_exec_object { /** * User's handle for a buffer to be bound into the GTT for this * operation. */ __u32 handle; /** Number of relocations to be performed on this buffer */ __u32 relocation_count; /** * Pointer to array of struct drm_i915_gem_relocation_entry containing * the relocations to be performed in this buffer. */ __u64 relocs_ptr; /** Required alignment in graphics aperture */ __u64 alignment; /** * Returned value of the updated offset of the object, for future * presumed_offset writes. */ __u64 offset; }; struct drm_i915_gem_execbuffer { /** * List of buffers to be validated with their relocations to be * performend on them. * * This is a pointer to an array of struct drm_i915_gem_validate_entry. * * These buffers must be listed in an order such that all relocations * a buffer is performing refer to buffers that have already appeared * in the validate list. */ __u64 buffers_ptr; __u32 buffer_count; /** Offset in the batchbuffer to start execution from. */ __u32 batch_start_offset; /** Bytes used in batchbuffer from batch_start_offset */ __u32 batch_len; __u32 DR1; __u32 DR4; __u32 num_cliprects; /** This is a struct drm_clip_rect *cliprects */ __u64 cliprects_ptr; }; struct drm_i915_gem_exec_object2 { /** * User's handle for a buffer to be bound into the GTT for this * operation. */ __u32 handle; /** Number of relocations to be performed on this buffer */ __u32 relocation_count; /** * Pointer to array of struct drm_i915_gem_relocation_entry containing * the relocations to be performed in this buffer. */ __u64 relocs_ptr; /** Required alignment in graphics aperture */ __u64 alignment; /** * When the EXEC_OBJECT_PINNED flag is specified this is populated by * the user with the GTT offset at which this object will be pinned. * When the I915_EXEC_NO_RELOC flag is specified this must contain the * presumed_offset of the object. * During execbuffer2 the kernel populates it with the value of the * current GTT offset of the object, for future presumed_offset writes. */ __u64 offset; #define EXEC_OBJECT_NEEDS_FENCE (1<<0) #define EXEC_OBJECT_NEEDS_GTT (1<<1) #define EXEC_OBJECT_WRITE (1<<2) #define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1<<3) #define EXEC_OBJECT_PINNED (1<<4) #define EXEC_OBJECT_PAD_TO_SIZE (1<<5) /* The kernel implicitly tracks GPU activity on all GEM objects, and * synchronises operations with outstanding rendering. This includes * rendering on other devices if exported via dma-buf. However, sometimes * this tracking is too coarse and the user knows better. For example, * if the object is split into non-overlapping ranges shared between different * clients or engines (i.e. suballocating objects), the implicit tracking * by kernel assumes that each operation affects the whole object rather * than an individual range, causing needless synchronisation between clients. * The kernel will also forgo any CPU cache flushes prior to rendering from * the object as the client is expected to be also handling such domain * tracking. * * The kernel maintains the implicit tracking in order to manage resources * used by the GPU - this flag only disables the synchronisation prior to * rendering with this object in this execbuf. * * Opting out of implicit synhronisation requires the user to do its own * explicit tracking to avoid rendering corruption. See, for example, * I915_PARAM_HAS_EXEC_FENCE to order execbufs and execute them asynchronously. */ #define EXEC_OBJECT_ASYNC (1<<6) /* Request that the contents of this execobject be copied into the error * state upon a GPU hang involving this batch for post-mortem debugging. * These buffers are recorded in no particular order as "user" in * /sys/class/drm/cardN/error. Query I915_PARAM_HAS_EXEC_CAPTURE to see * if the kernel supports this flag. */ #define EXEC_OBJECT_CAPTURE (1<<7) /* All remaining bits are MBZ and RESERVED FOR FUTURE USE */ #define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_CAPTURE<<1) __u64 flags; union { __u64 rsvd1; __u64 pad_to_size; }; __u64 rsvd2; }; struct drm_i915_gem_exec_fence { /** * User's handle for a drm_syncobj to wait on or signal. */ __u32 handle; #define I915_EXEC_FENCE_WAIT (1<<0) #define I915_EXEC_FENCE_SIGNAL (1<<1) #define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1)) __u32 flags; }; struct drm_i915_gem_execbuffer2 { /** * List of gem_exec_object2 structs */ __u64 buffers_ptr; __u32 buffer_count; /** Offset in the batchbuffer to start execution from. */ __u32 batch_start_offset; /** Bytes used in batchbuffer from batch_start_offset */ __u32 batch_len; __u32 DR1; __u32 DR4; __u32 num_cliprects; /** * This is a struct drm_clip_rect *cliprects if I915_EXEC_FENCE_ARRAY * is not set. If I915_EXEC_FENCE_ARRAY is set, then this is a * struct drm_i915_gem_exec_fence *fences. */ __u64 cliprects_ptr; #define I915_EXEC_RING_MASK (7<<0) #define I915_EXEC_DEFAULT (0<<0) #define I915_EXEC_RENDER (1<<0) #define I915_EXEC_BSD (2<<0) #define I915_EXEC_BLT (3<<0) #define I915_EXEC_VEBOX (4<<0) /* Used for switching the constants addressing mode on gen4+ RENDER ring. * Gen6+ only supports relative addressing to dynamic state (default) and * absolute addressing. * * These flags are ignored for the BSD and BLT rings. */ #define I915_EXEC_CONSTANTS_MASK (3<<6) #define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */ #define I915_EXEC_CONSTANTS_ABSOLUTE (1<<6) #define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */ __u64 flags; __u64 rsvd1; /* now used for context info */ __u64 rsvd2; }; /** Resets the SO write offset registers for transform feedback on gen7. */ #define I915_EXEC_GEN7_SOL_RESET (1<<8) /** Request a privileged ("secure") batch buffer. Note only available for * DRM_ROOT_ONLY | DRM_MASTER processes. */ #define I915_EXEC_SECURE (1<<9) /** Inform the kernel that the batch is and will always be pinned. This * negates the requirement for a workaround to be performed to avoid * an incoherent CS (such as can be found on 830/845). If this flag is * not passed, the kernel will endeavour to make sure the batch is * coherent with the CS before execution. If this flag is passed, * userspace assumes the responsibility for ensuring the same. */ #define I915_EXEC_IS_PINNED (1<<10) /** Provide a hint to the kernel that the command stream and auxiliary * state buffers already holds the correct presumed addresses and so the * relocation process may be skipped if no buffers need to be moved in * preparation for the execbuffer. */ #define I915_EXEC_NO_RELOC (1<<11) /** Use the reloc.handle as an index into the exec object array rather * than as the per-file handle. */ #define I915_EXEC_HANDLE_LUT (1<<12) /** Used for switching BSD rings on the platforms with two BSD rings */ #define I915_EXEC_BSD_SHIFT (13) #define I915_EXEC_BSD_MASK (3 << I915_EXEC_BSD_SHIFT) /* default ping-pong mode */ #define I915_EXEC_BSD_DEFAULT (0 << I915_EXEC_BSD_SHIFT) #define I915_EXEC_BSD_RING1 (1 << I915_EXEC_BSD_SHIFT) #define I915_EXEC_BSD_RING2 (2 << I915_EXEC_BSD_SHIFT) /** Tell the kernel that the batchbuffer is processed by * the resource streamer. */ #define I915_EXEC_RESOURCE_STREAMER (1<<15) /* Setting I915_EXEC_FENCE_IN implies that lower_32_bits(rsvd2) represent * a sync_file fd to wait upon (in a nonblocking manner) prior to executing * the batch. * * Returns -EINVAL if the sync_file fd cannot be found. */ #define I915_EXEC_FENCE_IN (1<<16) /* Setting I915_EXEC_FENCE_OUT causes the ioctl to return a sync_file fd * in the upper_32_bits(rsvd2) upon success. Ownership of the fd is given * to the caller, and it should be close() after use. (The fd is a regular * file descriptor and will be cleaned up on process termination. It holds * a reference to the request, but nothing else.) * * The sync_file fd can be combined with other sync_file and passed either * to execbuf using I915_EXEC_FENCE_IN, to atomic KMS ioctls (so that a flip * will only occur after this request completes), or to other devices. * * Using I915_EXEC_FENCE_OUT requires use of * DRM_IOCTL_I915_GEM_EXECBUFFER2_WR ioctl so that the result is written * back to userspace. Failure to do so will cause the out-fence to always * be reported as zero, and the real fence fd to be leaked. */ #define I915_EXEC_FENCE_OUT (1<<17) /* * Traditionally the execbuf ioctl has only considered the final element in * the execobject[] to be the executable batch. Often though, the client * will known the batch object prior to construction and being able to place * it into the execobject[] array first can simplify the relocation tracking. * Setting I915_EXEC_BATCH_FIRST tells execbuf to use element 0 of the * execobject[] as the * batch instead (the default is to use the last * element). */ #define I915_EXEC_BATCH_FIRST (1<<18) /* Setting I915_FENCE_ARRAY implies that num_cliprects and cliprects_ptr * define an array of i915_gem_exec_fence structures which specify a set of * dma fences to wait upon or signal. */ #define I915_EXEC_FENCE_ARRAY (1<<19) #define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_ARRAY<<1)) #define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) #define i915_execbuffer2_set_context_id(eb2, context) \ (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK #define i915_execbuffer2_get_context_id(eb2) \ ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK) struct drm_i915_gem_pin { /** Handle of the buffer to be pinned. */ __u32 handle; __u32 pad; /** alignment required within the aperture */ __u64 alignment; /** Returned GTT offset of the buffer. */ __u64 offset; }; struct drm_i915_gem_unpin { /** Handle of the buffer to be unpinned. */ __u32 handle; __u32 pad; }; struct drm_i915_gem_busy { /** Handle of the buffer to check for busy */ __u32 handle; /** Return busy status * * A return of 0 implies that the object is idle (after * having flushed any pending activity), and a non-zero return that * the object is still in-flight on the GPU. (The GPU has not yet * signaled completion for all pending requests that reference the * object.) An object is guaranteed to become idle eventually (so * long as no new GPU commands are executed upon it). Due to the * asynchronous nature of the hardware, an object reported * as busy may become idle before the ioctl is completed. * * Furthermore, if the object is busy, which engine is busy is only * provided as a guide. There are race conditions which prevent the * report of which engines are busy from being always accurate. * However, the converse is not true. If the object is idle, the * result of the ioctl, that all engines are idle, is accurate. * * The returned dword is split into two fields to indicate both * the engines on which the object is being read, and the * engine on which it is currently being written (if any). * * The low word (bits 0:15) indicate if the object is being written * to by any engine (there can only be one, as the GEM implicit * synchronisation rules force writes to be serialised). Only the * engine for the last write is reported. * * The high word (bits 16:31) are a bitmask of which engines are * currently reading from the object. Multiple engines may be * reading from the object simultaneously. * * The value of each engine is the same as specified in the * EXECBUFFER2 ioctl, i.e. I915_EXEC_RENDER, I915_EXEC_BSD etc. * Note I915_EXEC_DEFAULT is a symbolic value and is mapped to * the I915_EXEC_RENDER engine for execution, and so it is never * reported as active itself. Some hardware may have parallel * execution engines, e.g. multiple media engines, which are * mapped to the same identifier in the EXECBUFFER2 ioctl and * so are not separately reported for busyness. * * Caveat emptor: * Only the boolean result of this query is reliable; that is whether * the object is idle or busy. The report of which engines are busy * should be only used as a heuristic. */ __u32 busy; }; /** * I915_CACHING_NONE * * GPU access is not coherent with cpu caches. Default for machines without an * LLC. */ #define I915_CACHING_NONE 0 /** * I915_CACHING_CACHED * * GPU access is coherent with cpu caches and furthermore the data is cached in * last-level caches shared between cpu cores and the gpu GT. Default on * machines with HAS_LLC. */ #define I915_CACHING_CACHED 1 /** * I915_CACHING_DISPLAY * * Special GPU caching mode which is coherent with the scanout engines. * Transparently falls back to I915_CACHING_NONE on platforms where no special * cache mode (like write-through or gfdt flushing) is available. The kernel * automatically sets this mode when using a buffer as a scanout target. * Userspace can manually set this mode to avoid a costly stall and clflush in * the hotpath of drawing the first frame. */ #define I915_CACHING_DISPLAY 2 struct drm_i915_gem_caching { /** * Handle of the buffer to set/get the caching level of. */ __u32 handle; /** * Cacheing level to apply or return value * * bits0-15 are for generic caching control (i.e. the above defined * values). bits16-31 are reserved for platform-specific variations * (e.g. l3$ caching on gen7). */ __u32 caching; }; #define I915_TILING_NONE 0 #define I915_TILING_X 1 #define I915_TILING_Y 2 #define I915_TILING_LAST I915_TILING_Y #define I915_BIT_6_SWIZZLE_NONE 0 #define I915_BIT_6_SWIZZLE_9 1 #define I915_BIT_6_SWIZZLE_9_10 2 #define I915_BIT_6_SWIZZLE_9_11 3 #define I915_BIT_6_SWIZZLE_9_10_11 4 /* Not seen by userland */ #define I915_BIT_6_SWIZZLE_UNKNOWN 5 /* Seen by userland. */ #define I915_BIT_6_SWIZZLE_9_17 6 #define I915_BIT_6_SWIZZLE_9_10_17 7 struct drm_i915_gem_set_tiling { /** Handle of the buffer to have its tiling state updated */ __u32 handle; /** * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X, * I915_TILING_Y). * * This value is to be set on request, and will be updated by the * kernel on successful return with the actual chosen tiling layout. * * The tiling mode may be demoted to I915_TILING_NONE when the system * has bit 6 swizzling that can't be managed correctly by GEM. * * Buffer contents become undefined when changing tiling_mode. */ __u32 tiling_mode; /** * Stride in bytes for the object when in I915_TILING_X or * I915_TILING_Y. */ __u32 stride; /** * Returned address bit 6 swizzling required for CPU access through * mmap mapping. */ __u32 swizzle_mode; }; struct drm_i915_gem_get_tiling { /** Handle of the buffer to get tiling state for. */ __u32 handle; /** * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X, * I915_TILING_Y). */ __u32 tiling_mode; /** * Returned address bit 6 swizzling required for CPU access through * mmap mapping. */ __u32 swizzle_mode; /** * Returned address bit 6 swizzling required for CPU access through * mmap mapping whilst bound. */ __u32 phys_swizzle_mode; }; struct drm_i915_gem_get_aperture { /** Total size of the aperture used by i915_gem_execbuffer, in bytes */ __u64 aper_size; /** * Available space in the aperture used by i915_gem_execbuffer, in * bytes */ __u64 aper_available_size; }; struct drm_i915_get_pipe_from_crtc_id { /** ID of CRTC being requested **/ __u32 crtc_id; /** pipe of requested CRTC **/ __u32 pipe; }; #define I915_MADV_WILLNEED 0 #define I915_MADV_DONTNEED 1 #define __I915_MADV_PURGED 2 /* internal state */ struct drm_i915_gem_madvise { /** Handle of the buffer to change the backing store advice */ __u32 handle; /* Advice: either the buffer will be needed again in the near future, * or wont be and could be discarded under memory pressure. */ __u32 madv; /** Whether the backing store still exists. */ __u32 retained; }; /* flags */ #define I915_OVERLAY_TYPE_MASK 0xff #define I915_OVERLAY_YUV_PLANAR 0x01 #define I915_OVERLAY_YUV_PACKED 0x02 #define I915_OVERLAY_RGB 0x03 #define I915_OVERLAY_DEPTH_MASK 0xff00 #define I915_OVERLAY_RGB24 0x1000 #define I915_OVERLAY_RGB16 0x2000 #define I915_OVERLAY_RGB15 0x3000 #define I915_OVERLAY_YUV422 0x0100 #define I915_OVERLAY_YUV411 0x0200 #define I915_OVERLAY_YUV420 0x0300 #define I915_OVERLAY_YUV410 0x0400 #define I915_OVERLAY_SWAP_MASK 0xff0000 #define I915_OVERLAY_NO_SWAP 0x000000 #define I915_OVERLAY_UV_SWAP 0x010000 #define I915_OVERLAY_Y_SWAP 0x020000 #define I915_OVERLAY_Y_AND_UV_SWAP 0x030000 #define I915_OVERLAY_FLAGS_MASK 0xff000000 #define I915_OVERLAY_ENABLE 0x01000000 struct drm_intel_overlay_put_image { /* various flags and src format description */ __u32 flags; /* source picture description */ __u32 bo_handle; /* stride values and offsets are in bytes, buffer relative */ __u16 stride_Y; /* stride for packed formats */ __u16 stride_UV; __u32 offset_Y; /* offset for packet formats */ __u32 offset_U; __u32 offset_V; /* in pixels */ __u16 src_width; __u16 src_height; /* to compensate the scaling factors for partially covered surfaces */ __u16 src_scan_width; __u16 src_scan_height; /* output crtc description */ __u32 crtc_id; __u16 dst_x; __u16 dst_y; __u16 dst_width; __u16 dst_height; }; /* flags */ #define I915_OVERLAY_UPDATE_ATTRS (1<<0) #define I915_OVERLAY_UPDATE_GAMMA (1<<1) #define I915_OVERLAY_DISABLE_DEST_COLORKEY (1<<2) struct drm_intel_overlay_attrs { __u32 flags; __u32 color_key; __s32 brightness; __u32 contrast; __u32 saturation; __u32 gamma0; __u32 gamma1; __u32 gamma2; __u32 gamma3; __u32 gamma4; __u32 gamma5; }; /* * Intel sprite handling * * Color keying works with a min/mask/max tuple. Both source and destination * color keying is allowed. * * Source keying: * Sprite pixels within the min & max values, masked against the color channels * specified in the mask field, will be transparent. All other pixels will * be displayed on top of the primary plane. For RGB surfaces, only the min * and mask fields will be used; ranged compares are not allowed. * * Destination keying: * Primary plane pixels that match the min value, masked against the color * channels specified in the mask field, will be replaced by corresponding * pixels from the sprite plane. * * Note that source & destination keying are exclusive; only one can be * active on a given plane. */ #define I915_SET_COLORKEY_NONE (1<<0) /* disable color key matching */ #define I915_SET_COLORKEY_DESTINATION (1<<1) #define I915_SET_COLORKEY_SOURCE (1<<2) struct drm_intel_sprite_colorkey { __u32 plane_id; __u32 min_value; __u32 channel_mask; __u32 max_value; __u32 flags; }; struct drm_i915_gem_wait { /** Handle of BO we shall wait on */ __u32 bo_handle; __u32 flags; /** Number of nanoseconds to wait, Returns time remaining. */ __s64 timeout_ns; }; struct drm_i915_gem_context_create { /* output: id of new context*/ __u32 ctx_id; __u32 pad; }; struct drm_i915_gem_context_destroy { __u32 ctx_id; __u32 pad; }; struct drm_i915_reg_read { /* * Register offset. * For 64bit wide registers where the upper 32bits don't immediately * follow the lower 32bits, the offset of the lower 32bits must * be specified */ __u64 offset; #define I915_REG_READ_8B_WA (1ul << 0) __u64 val; /* Return value */ }; /* Known registers: * * Render engine timestamp - 0x2358 + 64bit - gen7+ * - Note this register returns an invalid value if using the default * single instruction 8byte read, in order to workaround that pass * flag I915_REG_READ_8B_WA in offset field. * */ struct drm_i915_reset_stats { __u32 ctx_id; __u32 flags; /* All resets since boot/module reload, for all contexts */ __u32 reset_count; /* Number of batches lost when active in GPU, for this context */ __u32 batch_active; /* Number of batches lost pending for execution, for this context */ __u32 batch_pending; __u32 pad; }; struct drm_i915_gem_userptr { __u64 user_ptr; __u64 user_size; __u32 flags; #define I915_USERPTR_READ_ONLY 0x1 #define I915_USERPTR_UNSYNCHRONIZED 0x80000000 /** * Returned handle for the object. * * Object handles are nonzero. */ __u32 handle; }; struct drm_i915_gem_context_param { __u32 ctx_id; __u32 size; __u64 param; #define I915_CONTEXT_PARAM_BAN_PERIOD 0x1 #define I915_CONTEXT_PARAM_NO_ZEROMAP 0x2 #define I915_CONTEXT_PARAM_GTT_SIZE 0x3 #define I915_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4 #define I915_CONTEXT_PARAM_BANNABLE 0x5 #define I915_CONTEXT_PARAM_PRIORITY 0x6 #define I915_CONTEXT_MAX_USER_PRIORITY 1023 /* inclusive */ #define I915_CONTEXT_DEFAULT_PRIORITY 0 #define I915_CONTEXT_MIN_USER_PRIORITY -1023 /* inclusive */ __u64 value; }; enum drm_i915_oa_format { I915_OA_FORMAT_A13 = 1, /* HSW only */ I915_OA_FORMAT_A29, /* HSW only */ I915_OA_FORMAT_A13_B8_C8, /* HSW only */ I915_OA_FORMAT_B4_C8, /* HSW only */ I915_OA_FORMAT_A45_B8_C8, /* HSW only */ I915_OA_FORMAT_B4_C8_A16, /* HSW only */ I915_OA_FORMAT_C4_B8, /* HSW+ */ /* Gen8+ */ I915_OA_FORMAT_A12, I915_OA_FORMAT_A12_B8_C8, I915_OA_FORMAT_A32u40_A4u32_B8_C8, I915_OA_FORMAT_MAX /* non-ABI */ }; enum drm_i915_perf_property_id { /** * Open the stream for a specific context handle (as used with * execbuffer2). A stream opened for a specific context this way * won't typically require root privileges. */ DRM_I915_PERF_PROP_CTX_HANDLE = 1, /** * A value of 1 requests the inclusion of raw OA unit reports as * part of stream samples. */ DRM_I915_PERF_PROP_SAMPLE_OA, /** * The value specifies which set of OA unit metrics should be * be configured, defining the contents of any OA unit reports. */ DRM_I915_PERF_PROP_OA_METRICS_SET, /** * The value specifies the size and layout of OA unit reports. */ DRM_I915_PERF_PROP_OA_FORMAT, /** * Specifying this property implicitly requests periodic OA unit * sampling and (at least on Haswell) the sampling frequency is derived * from this exponent as follows: * * 80ns * 2^(period_exponent + 1) */ DRM_I915_PERF_PROP_OA_EXPONENT, DRM_I915_PERF_PROP_MAX /* non-ABI */ }; struct drm_i915_perf_open_param { __u32 flags; #define I915_PERF_FLAG_FD_CLOEXEC (1<<0) #define I915_PERF_FLAG_FD_NONBLOCK (1<<1) #define I915_PERF_FLAG_DISABLED (1<<2) /** The number of u64 (id, value) pairs */ __u32 num_properties; /** * Pointer to array of u64 (id, value) pairs configuring the stream * to open. */ __u64 properties_ptr; }; /** * Enable data capture for a stream that was either opened in a disabled state * via I915_PERF_FLAG_DISABLED or was later disabled via * I915_PERF_IOCTL_DISABLE. * * It is intended to be cheaper to disable and enable a stream than it may be * to close and re-open a stream with the same configuration. * * It's undefined whether any pending data for the stream will be lost. */ #define I915_PERF_IOCTL_ENABLE _IO('i', 0x0) /** * Disable data capture for a stream. * * It is an error to try and read a stream that is disabled. */ #define I915_PERF_IOCTL_DISABLE _IO('i', 0x1) /** * Common to all i915 perf records */ struct drm_i915_perf_record_header { __u32 type; __u16 pad; __u16 size; }; enum drm_i915_perf_record_type { /** * Samples are the work horse record type whose contents are extensible * and defined when opening an i915 perf stream based on the given * properties. * * Boolean properties following the naming convention * DRM_I915_PERF_SAMPLE_xyz_PROP request the inclusion of 'xyz' data in * every sample. * * The order of these sample properties given by userspace has no * affect on the ordering of data within a sample. The order is * documented here. * * struct { * struct drm_i915_perf_record_header header; * * { u32 oa_report[]; } && DRM_I915_PERF_PROP_SAMPLE_OA * }; */ DRM_I915_PERF_RECORD_SAMPLE = 1, /* * Indicates that one or more OA reports were not written by the * hardware. This can happen for example if an MI_REPORT_PERF_COUNT * command collides with periodic sampling - which would be more likely * at higher sampling frequencies. */ DRM_I915_PERF_RECORD_OA_REPORT_LOST = 2, /** * An error occurred that resulted in all pending OA reports being lost. */ DRM_I915_PERF_RECORD_OA_BUFFER_LOST = 3, DRM_I915_PERF_RECORD_MAX /* non-ABI */ }; /** * Structure to upload perf dynamic configuration into the kernel. */ struct drm_i915_perf_oa_config { /** String formatted like "%08x-%04x-%04x-%04x-%012x" */ char uuid[36]; __u32 n_mux_regs; __u32 n_boolean_regs; __u32 n_flex_regs; /* * These fields are pointers to tuples of u32 values (register * address, value). For example the expected length of the buffer * pointed by mux_regs_ptr is (2 * sizeof(u32) * n_mux_regs). */ __u64 mux_regs_ptr; __u64 boolean_regs_ptr; __u64 flex_regs_ptr; }; #if defined(__cplusplus) } #endif # 1542 "./include/uapi/drm/i915_drm.h" #endif /* _UAPI_I915_DRM_H_ */ # 1544 "./include/uapi/drm/i915_drm.h" # 34 "drivers/gpu/drm/i915/i915_drv.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "drivers/gpu/drm/i915/i915_drv.h" # 1 "./include/uapi/drm/drm_fourcc.h" 1 /* * Copyright 2011 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H #if 0 /* expanded by -frewrite-includes */ #include "drm.h" #endif /* expanded by -frewrite-includes */ # 27 "./include/uapi/drm/drm_fourcc.h" # 28 "./include/uapi/drm/drm_fourcc.h" #if defined(__cplusplus) extern "C" { #endif # 32 "./include/uapi/drm/drm_fourcc.h" #define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \ ((__u32)(c) << 16) | ((__u32)(d) << 24)) #define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */ /* color index */ #define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ /* 8 bpp Red */ #define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */ /* 16 bpp Red */ #define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */ /* 16 bpp RG */ #define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */ #define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */ /* 32 bpp RG */ #define DRM_FORMAT_RG1616 fourcc_code('R', 'G', '3', '2') /* [31:0] R:G 16:16 little endian */ #define DRM_FORMAT_GR1616 fourcc_code('G', 'R', '3', '2') /* [31:0] G:R 16:16 little endian */ /* 8 bpp RGB */ #define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */ #define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */ /* 16 bpp RGB */ #define DRM_FORMAT_XRGB4444 fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */ #define DRM_FORMAT_XBGR4444 fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */ #define DRM_FORMAT_RGBX4444 fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */ #define DRM_FORMAT_BGRX4444 fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */ #define DRM_FORMAT_ARGB4444 fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */ #define DRM_FORMAT_ABGR4444 fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */ #define DRM_FORMAT_RGBA4444 fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */ #define DRM_FORMAT_BGRA4444 fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */ #define DRM_FORMAT_XRGB1555 fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */ #define DRM_FORMAT_XBGR1555 fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */ #define DRM_FORMAT_RGBX5551 fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */ #define DRM_FORMAT_BGRX5551 fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */ #define DRM_FORMAT_ARGB1555 fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */ #define DRM_FORMAT_ABGR1555 fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */ #define DRM_FORMAT_RGBA5551 fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */ #define DRM_FORMAT_BGRA5551 fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */ #define DRM_FORMAT_RGB565 fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */ #define DRM_FORMAT_BGR565 fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */ /* 24 bpp RGB */ #define DRM_FORMAT_RGB888 fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */ #define DRM_FORMAT_BGR888 fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */ /* 32 bpp RGB */ #define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */ #define DRM_FORMAT_XBGR8888 fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */ #define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */ #define DRM_FORMAT_BGRX8888 fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */ #define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */ #define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */ #define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */ #define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */ #define DRM_FORMAT_XRGB2101010 fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */ #define DRM_FORMAT_XBGR2101010 fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */ #define DRM_FORMAT_RGBX1010102 fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */ #define DRM_FORMAT_BGRX1010102 fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */ #define DRM_FORMAT_ARGB2101010 fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */ #define DRM_FORMAT_ABGR2101010 fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */ #define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */ #define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */ /* packed YCbCr */ #define DRM_FORMAT_YUYV fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */ #define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */ #define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */ #define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */ #define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ /* * 2 plane RGB + A * index 0 = RGB plane, same format as the corresponding non _A8 format has * index 1 = A plane, [7:0] A */ #define DRM_FORMAT_XRGB8888_A8 fourcc_code('X', 'R', 'A', '8') #define DRM_FORMAT_XBGR8888_A8 fourcc_code('X', 'B', 'A', '8') #define DRM_FORMAT_RGBX8888_A8 fourcc_code('R', 'X', 'A', '8') #define DRM_FORMAT_BGRX8888_A8 fourcc_code('B', 'X', 'A', '8') #define DRM_FORMAT_RGB888_A8 fourcc_code('R', '8', 'A', '8') #define DRM_FORMAT_BGR888_A8 fourcc_code('B', '8', 'A', '8') #define DRM_FORMAT_RGB565_A8 fourcc_code('R', '5', 'A', '8') #define DRM_FORMAT_BGR565_A8 fourcc_code('B', '5', 'A', '8') /* * 2 plane YCbCr * index 0 = Y plane, [7:0] Y * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian * or * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian */ #define DRM_FORMAT_NV12 fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */ #define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */ #define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */ #define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ #define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */ #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */ /* * 3 plane YCbCr * index 0: Y plane, [7:0] Y * index 1: Cb plane, [7:0] Cb * index 2: Cr plane, [7:0] Cr * or * index 1: Cr plane, [7:0] Cr * index 2: Cb plane, [7:0] Cb */ #define DRM_FORMAT_YUV410 fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU410 fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */ #define DRM_FORMAT_YUV411 fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU411 fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */ #define DRM_FORMAT_YUV420 fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU420 fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */ #define DRM_FORMAT_YUV422 fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU422 fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */ #define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */ /* * Format Modifiers: * * Format modifiers describe, typically, a re-ordering or modification * of the data in a plane of an FB. This can be used to express tiled/ * swizzled formats, or compression, or a combination of the two. * * The upper 8 bits of the format modifier are a vendor-id as assigned * below. The lower 56 bits are assigned as vendor sees fit. */ /* Vendor Ids: */ #define DRM_FORMAT_MOD_NONE 0 #define DRM_FORMAT_MOD_VENDOR_NONE 0 #define DRM_FORMAT_MOD_VENDOR_INTEL 0x01 #define DRM_FORMAT_MOD_VENDOR_AMD 0x02 #define DRM_FORMAT_MOD_VENDOR_NV 0x03 #define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 #define DRM_FORMAT_MOD_VENDOR_QCOM 0x05 #define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06 #define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07 /* add more to the end as needed */ #define DRM_FORMAT_RESERVED ((1ULL << 56) - 1) #define fourcc_mod_code(vendor, val) \ ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | (val & 0x00ffffffffffffffULL)) /* * Format Modifier tokens: * * When adding a new token please document the layout with a code comment, * similar to the fourcc codes above. drm_fourcc.h is considered the * authoritative source for all of these. */ /* * Invalid Modifier * * This modifier can be used as a sentinel to terminate the format modifiers * list, or to initialize a variable with an invalid modifier. It might also be * used to report an error back to userspace for certain APIs. */ #define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED) /* * Linear Layout * * Just plain linear layout. Note that this is different from no specifying any * modifier (e.g. not setting DRM_MODE_FB_MODIFIERS in the DRM_ADDFB2 ioctl), * which tells the driver to also take driver-internal information into account * and so might actually result in a tiled framebuffer. */ #define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0) /* Intel framebuffer modifiers */ /* * Intel X-tiling layout * * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb) * in row-major layout. Within the tile bytes are laid out row-major, with * a platform-dependent stride. On top of that the memory can apply * platform-depending swizzling of some higher address bits into bit6. * * This format is highly platforms specific and not useful for cross-driver * sharing. It exists since on a given platform it does uniquely identify the * layout in a simple way for i915-specific userspace. */ #define I915_FORMAT_MOD_X_TILED fourcc_mod_code(INTEL, 1) /* * Intel Y-tiling layout * * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb) * in row-major layout. Within the tile bytes are laid out in OWORD (16 bytes) * chunks column-major, with a platform-dependent height. On top of that the * memory can apply platform-depending swizzling of some higher address bits * into bit6. * * This format is highly platforms specific and not useful for cross-driver * sharing. It exists since on a given platform it does uniquely identify the * layout in a simple way for i915-specific userspace. */ #define I915_FORMAT_MOD_Y_TILED fourcc_mod_code(INTEL, 2) /* * Intel Yf-tiling layout * * This is a tiled layout using 4Kb tiles in row-major layout. * Within the tile pixels are laid out in 16 256 byte units / sub-tiles which * are arranged in four groups (two wide, two high) with column-major layout. * Each group therefore consits out of four 256 byte units, which are also laid * out as 2x2 column-major. * 256 byte units are made out of four 64 byte blocks of pixels, producing * either a square block or a 2:1 unit. * 64 byte blocks of pixels contain four pixel rows of 16 bytes, where the width * in pixel depends on the pixel depth. */ #define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3) /* * Intel color control surface (CCS) for render compression * * The framebuffer format must be one of the 8:8:8:8 RGB formats. * The main surface will be plane index 0 and must be Y/Yf-tiled, * the CCS will be plane index 1. * * Each CCS tile matches a 1024x512 pixel area of the main surface. * To match certain aspects of the 3D hardware the CCS is * considered to be made up of normal 128Bx32 Y tiles, Thus * the CCS pitch must be specified in multiples of 128 bytes. * * In reality the CCS tile appears to be a 64Bx64 Y tile, composed * of QWORD (8 bytes) chunks instead of OWORD (16 bytes) chunks. * But that fact is not relevant unless the memory is accessed * directly. */ #define I915_FORMAT_MOD_Y_TILED_CCS fourcc_mod_code(INTEL, 4) #define I915_FORMAT_MOD_Yf_TILED_CCS fourcc_mod_code(INTEL, 5) /* * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks * * Macroblocks are laid in a Z-shape, and each pixel data is following the * standard NV12 style. * As for NV12, an image is the result of two frame buffers: one for Y, * one for the interleaved Cb/Cr components (1/2 the height of the Y buffer). * Alignment requirements are (for each buffer): * - multiple of 128 pixels for the width * - multiple of 32 pixels for the height * * For more information: see https://linuxtv.org/downloads/v4l-dvb-apis/re32.html */ #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) /* Vivante framebuffer modifiers */ /* * Vivante 4x4 tiling layout * * This is a simple tiled layout using tiles of 4x4 pixels in a row-major * layout. */ #define DRM_FORMAT_MOD_VIVANTE_TILED fourcc_mod_code(VIVANTE, 1) /* * Vivante 64x64 super-tiling layout * * This is a tiled layout using 64x64 pixel super-tiles, where each super-tile * contains 8x4 groups of 2x4 tiles of 4x4 pixels (like above) each, all in row- * major layout. * * For more information: see * https://github.com/etnaviv/etna_viv/blob/master/doc/hardware.md#texture-tiling */ #define DRM_FORMAT_MOD_VIVANTE_SUPER_TILED fourcc_mod_code(VIVANTE, 2) /* * Vivante 4x4 tiling layout for dual-pipe * * Same as the 4x4 tiling layout, except every second 4x4 pixel tile starts at a * different base address. Offsets from the base addresses are therefore halved * compared to the non-split tiled layout. */ #define DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED fourcc_mod_code(VIVANTE, 3) /* * Vivante 64x64 super-tiling layout for dual-pipe * * Same as the 64x64 super-tiling layout, except every second 4x4 pixel tile * starts at a different base address. Offsets from the base addresses are * therefore halved compared to the non-split super-tiled layout. */ #define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4) /* NVIDIA Tegra frame buffer modifiers */ /* * Some modifiers take parameters, for example the number of vertical GOBs in * a block. Reserve the lower 32 bits for parameters */ #define __fourcc_mod_tegra_mode_shift 32 #define fourcc_mod_tegra_code(val, params) \ fourcc_mod_code(NV, ((((__u64)val) << __fourcc_mod_tegra_mode_shift) | params)) #define fourcc_mod_tegra_mod(m) \ (m & ~((1ULL << __fourcc_mod_tegra_mode_shift) - 1)) #define fourcc_mod_tegra_param(m) \ (m & ((1ULL << __fourcc_mod_tegra_mode_shift) - 1)) /* * Tegra Tiled Layout, used by Tegra 2, 3 and 4. * * Pixels are arranged in simple tiles of 16 x 16 bytes. */ #define NV_FORMAT_MOD_TEGRA_TILED fourcc_mod_tegra_code(1, 0) /* * Tegra 16Bx2 Block Linear layout, used by TK1/TX1 * * Pixels are arranged in 64x8 Groups Of Bytes (GOBs). GOBs are then stacked * vertically by a power of 2 (1 to 32 GOBs) to form a block. * * Within a GOB, data is ordered as 16B x 2 lines sectors laid in Z-shape. * * Parameter 'v' is the log2 encoding of the number of GOBs stacked vertically. * Valid values are: * * 0 == ONE_GOB * 1 == TWO_GOBS * 2 == FOUR_GOBS * 3 == EIGHT_GOBS * 4 == SIXTEEN_GOBS * 5 == THIRTYTWO_GOBS * * Chapter 20 "Pixel Memory Formats" of the Tegra X1 TRM describes this format * in full detail. */ #define NV_FORMAT_MOD_TEGRA_16BX2_BLOCK(v) fourcc_mod_tegra_code(2, v) /* * Broadcom VC4 "T" format * * This is the primary layout that the V3D GPU can texture from (it * can't do linear). The T format has: * * - 64b utiles of pixels in a raster-order grid according to cpp. It's 4x4 * pixels at 32 bit depth. * * - 1k subtiles made of a 4x4 raster-order grid of 64b utiles (so usually * 16x16 pixels). * * - 4k tiles made of a 2x2 grid of 1k subtiles (so usually 32x32 pixels). On * even 4k tile rows, they're arranged as (BL, TL, TR, BR), and on odd rows * they're (TR, BR, BL, TL), where bottom left is start of memory. * * - an image made of 4k tiles in rows either left-to-right (even rows of 4k * tiles) or right-to-left (odd rows of 4k tiles). */ #define DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED fourcc_mod_code(BROADCOM, 1) #if defined(__cplusplus) } #endif # 409 "./include/uapi/drm/drm_fourcc.h" #endif /* DRM_FOURCC_H */ # 411 "./include/uapi/drm/drm_fourcc.h" # 35 "drivers/gpu/drm/i915/i915_drv.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "drivers/gpu/drm/i915/i915_drv.h" # 1 "./include/linux/io-mapping.h" 1 /* * Copyright © 2008 Keith Packard * * This file is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _LINUX_IO_MAPPING_H #define _LINUX_IO_MAPPING_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 21 "./include/linux/io-mapping.h" # 22 "./include/linux/io-mapping.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 22 "./include/linux/io-mapping.h" # 1 "./include/linux/slab.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ /* * Written by Mark Hemment, 1996 (markhe@nextd.demon.co.uk). * * (C) SGI 2006, Christoph Lameter * Cleaned up and restructured to ease the addition of alternative * implementations of SLAB allocators. * (C) Linux Foundation 2008-2013 * Unified interface for all slab allocators */ #ifndef _LINUX_SLAB_H #define _LINUX_SLAB_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 15 "./include/linux/slab.h" # 1 "./include/linux/gfp.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __LINUX_GFP_H #define __LINUX_GFP_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/linux/gfp.h" # 1 "./include/linux/mmdebug.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef LINUX_MM_DEBUG_H #define LINUX_MM_DEBUG_H 1 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/linux/mmdebug.h" # 1 "./include/linux/bug.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_BUG_H #define _LINUX_BUG_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/linux/bug.h" # 1 "./arch/x86/include/asm/bug.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_BUG_H #define _ASM_X86_BUG_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./arch/x86/include/asm/bug.h" # 6 "./arch/x86/include/asm/bug.h" /* * Despite that some emulators terminate on UD2, we use it for WARN(). * * Since various instruction decoders/specs disagree on the encoding of * UD0/UD1. */ #define ASM_UD0 ".byte 0x0f, 0xff" /* + ModRM (for Intel) */ #define ASM_UD1 ".byte 0x0f, 0xb9" /* + ModRM */ #define ASM_UD2 ".byte 0x0f, 0x0b" #define INSN_UD0 0xff0f #define INSN_UD2 0x0b0f #define LEN_UD2 2 #ifdef CONFIG_GENERIC_BUG #ifdef CONFIG_X86_32 # define __BUG_REL(val) ".long " __stringify(val) #else # 28 "./arch/x86/include/asm/bug.h" # define __BUG_REL(val) ".long " __stringify(val) " - 2b" #endif # 30 "./arch/x86/include/asm/bug.h" #ifdef CONFIG_DEBUG_BUGVERBOSE #define _BUG_FLAGS(ins, flags) \ do { \ asm volatile("1:\t" ins "\n" \ ".pushsection __bug_table,\"aw\"\n" \ "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \ "\t.word %c1" "\t# bug_entry::line\n" \ "\t.word %c2" "\t# bug_entry::flags\n" \ "\t.org 2b+%c3\n" \ ".popsection" \ : : "i" (__FILE__), "i" (__LINE__), \ "i" (flags), \ "i" (sizeof(struct bug_entry))); \ } while (0) #else /* !CONFIG_DEBUG_BUGVERBOSE */ # 49 "./arch/x86/include/asm/bug.h" #define _BUG_FLAGS(ins, flags) \ do { \ asm volatile("1:\t" ins "\n" \ ".pushsection __bug_table,\"aw\"\n" \ "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ "\t.word %c0" "\t# bug_entry::flags\n" \ "\t.org 2b+%c1\n" \ ".popsection" \ : : "i" (flags), \ "i" (sizeof(struct bug_entry))); \ } while (0) #endif /* CONFIG_DEBUG_BUGVERBOSE */ # 63 "./arch/x86/include/asm/bug.h" #else # 65 "./arch/x86/include/asm/bug.h" #define _BUG_FLAGS(ins, flags) asm volatile(ins) #endif /* CONFIG_GENERIC_BUG */ # 69 "./arch/x86/include/asm/bug.h" #define HAVE_ARCH_BUG #define BUG() \ do { \ _BUG_FLAGS(ASM_UD2, 0); \ unreachable(); \ } while (0) #define __WARN_FLAGS(flags) \ do { \ _BUG_FLAGS(ASM_UD2, BUGFLAG_WARNING|(flags)); \ annotate_reachable(); \ } while (0) #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 83 "./arch/x86/include/asm/bug.h" # 1 "./include/asm-generic/bug.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_GENERIC_BUG_H #define _ASM_GENERIC_BUG_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/asm-generic/bug.h" # 6 "./include/asm-generic/bug.h" #define CUT_HERE "------------[ cut here ]------------\n" #ifdef CONFIG_GENERIC_BUG #define BUGFLAG_WARNING (1 << 0) #define BUGFLAG_ONCE (1 << 1) #define BUGFLAG_DONE (1 << 2) #define BUGFLAG_TAINT(taint) ((taint) << 8) #define BUG_GET_TAINT(bug) ((bug)->flags >> 8) #endif # 16 "./include/asm-generic/bug.h" #ifndef __ASSEMBLY__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 18 "./include/asm-generic/bug.h" # 1 "./include/linux/kernel.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_KERNEL_H #define _LINUX_KERNEL_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./include/linux/kernel.h" # 7 "./include/linux/kernel.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 7 "./include/linux/kernel.h" # 1 "./include/linux/linkage.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_LINKAGE_H #define _LINUX_LINKAGE_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/linux/linkage.h" # 6 "./include/linux/linkage.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./include/linux/linkage.h" # 7 "./include/linux/linkage.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 7 "./include/linux/linkage.h" # 1 "./include/linux/export.h" 1 #ifndef _LINUX_EXPORT_H #define _LINUX_EXPORT_H /* * Export symbols from the kernel to modules. Forked from module.h * to reduce the amount of pointless cruft we feed to gcc when only * exporting a simple symbol or two. * * Try not to add #includes here. It slows compilation and makes kernel * hackers place grumpy comments in header files. */ /* Some toolchains use a `_' prefix for all user symbols. */ #ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX #define __VMLINUX_SYMBOL(x) _##x #define __VMLINUX_SYMBOL_STR(x) "_" #x #else # 18 "./include/linux/export.h" #define __VMLINUX_SYMBOL(x) x #define __VMLINUX_SYMBOL_STR(x) #x #endif # 21 "./include/linux/export.h" /* Indirect, so macros are expanded before pasting. */ #define VMLINUX_SYMBOL(x) __VMLINUX_SYMBOL(x) #define VMLINUX_SYMBOL_STR(x) __VMLINUX_SYMBOL_STR(x) #ifndef __ASSEMBLY__ struct kernel_symbol { unsigned long value; const char *name; }; #ifdef MODULE extern struct module __this_module; #define THIS_MODULE (&__this_module) #else # 37 "./include/linux/export.h" #define THIS_MODULE ((struct module *)0) #endif # 39 "./include/linux/export.h" #ifdef CONFIG_MODULES #if defined(__KERNEL__) && !defined(__GENKSYMS__) #ifdef CONFIG_MODVERSIONS /* Mark the CRC weak since genksyms apparently decides not to * generate a checksums for some symbols */ #if defined(CONFIG_MODULE_REL_CRCS) #define __CRC_SYMBOL(sym, sec) \ asm(" .section \"___kcrctab" sec "+" #sym "\", \"a\" \n" \ " .weak " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \ " .long " VMLINUX_SYMBOL_STR(__crc_##sym) " - . \n" \ " .previous \n"); #else # 53 "./include/linux/export.h" #define __CRC_SYMBOL(sym, sec) \ asm(" .section \"___kcrctab" sec "+" #sym "\", \"a\" \n" \ " .weak " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \ " .long " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \ " .previous \n"); #endif # 59 "./include/linux/export.h" #else # 60 "./include/linux/export.h" #define __CRC_SYMBOL(sym, sec) #endif # 62 "./include/linux/export.h" /* For every exported symbol, place a struct in the __ksymtab section */ #define ___EXPORT_SYMBOL(sym, sec) \ extern typeof(sym) sym; \ __CRC_SYMBOL(sym, sec) \ static const char __kstrtab_##sym[] \ __attribute__((section("__ksymtab_strings"), aligned(1))) \ = VMLINUX_SYMBOL_STR(sym); \ static const struct kernel_symbol __ksymtab_##sym \ __used \ __attribute__((section("___ksymtab" sec "+" #sym), used)) \ = { (unsigned long)&sym, __kstrtab_##sym } #if defined(__KSYM_DEPS__) /* * For fine grained build dependencies, we want to tell the build system * about each possible exported symbol even if they're not actually exported. * We use a string pattern that is unlikely to be valid code that the build * system filters out from the preprocessor output (see ksym_dep_filter * in scripts/Kbuild.include). */ #define __EXPORT_SYMBOL(sym, sec) === __KSYM_##sym === #elif defined(CONFIG_TRIM_UNUSED_KSYMS) # 87 "./include/linux/export.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 88 "./include/linux/export.h" # 89 "./include/linux/export.h" #define __EXPORT_SYMBOL(sym, sec) \ __cond_export_sym(sym, sec, __is_defined(__KSYM_##sym)) #define __cond_export_sym(sym, sec, conf) \ ___cond_export_sym(sym, sec, conf) #define ___cond_export_sym(sym, sec, enabled) \ __cond_export_sym_##enabled(sym, sec) #define __cond_export_sym_1(sym, sec) ___EXPORT_SYMBOL(sym, sec) #define __cond_export_sym_0(sym, sec) /* nothing */ #else # 100 "./include/linux/export.h" #define __EXPORT_SYMBOL ___EXPORT_SYMBOL #endif # 102 "./include/linux/export.h" #define EXPORT_SYMBOL(sym) \ __EXPORT_SYMBOL(sym, "") #define EXPORT_SYMBOL_GPL(sym) \ __EXPORT_SYMBOL(sym, "_gpl") #define EXPORT_SYMBOL_GPL_FUTURE(sym) \ __EXPORT_SYMBOL(sym, "_gpl_future") #ifdef CONFIG_UNUSED_SYMBOLS #define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused") #define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl") #else # 116 "./include/linux/export.h" #define EXPORT_UNUSED_SYMBOL(sym) #define EXPORT_UNUSED_SYMBOL_GPL(sym) #endif # 119 "./include/linux/export.h" #endif /* __GENKSYMS__ */ # 121 "./include/linux/export.h" #else /* !CONFIG_MODULES... */ # 123 "./include/linux/export.h" #define EXPORT_SYMBOL(sym) #define EXPORT_SYMBOL_GPL(sym) #define EXPORT_SYMBOL_GPL_FUTURE(sym) #define EXPORT_UNUSED_SYMBOL(sym) #define EXPORT_UNUSED_SYMBOL_GPL(sym) #endif /* CONFIG_MODULES */ # 131 "./include/linux/export.h" #endif /* !__ASSEMBLY__ */ # 132 "./include/linux/export.h" #endif /* _LINUX_EXPORT_H */ # 134 "./include/linux/export.h" # 8 "./include/linux/linkage.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 8 "./include/linux/linkage.h" # 1 "./arch/x86/include/asm/linkage.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_LINKAGE_H #define _ASM_X86_LINKAGE_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./arch/x86/include/asm/linkage.h" # 6 "./arch/x86/include/asm/linkage.h" #undef notrace #define notrace __attribute__((no_instrument_function)) #ifdef CONFIG_X86_32 #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0))) #endif /* CONFIG_X86_32 */ # 13 "./arch/x86/include/asm/linkage.h" #ifdef __ASSEMBLY__ #define GLOBAL(name) \ .globl name; \ name: #if defined(CONFIG_X86_64) || defined(CONFIG_X86_ALIGNMENT_16) #define __ALIGN .p2align 4, 0x90 #define __ALIGN_STR __stringify(__ALIGN) #endif # 24 "./arch/x86/include/asm/linkage.h" #endif /* __ASSEMBLY__ */ # 26 "./arch/x86/include/asm/linkage.h" #endif /* _ASM_X86_LINKAGE_H */ # 28 "./arch/x86/include/asm/linkage.h" # 9 "./include/linux/linkage.h" 2 /* Some toolchains use other characters (e.g. '`') to mark new line in macro */ #ifndef ASM_NL #define ASM_NL ; #endif # 14 "./include/linux/linkage.h" #ifdef __cplusplus #define CPP_ASMLINKAGE extern "C" #else # 18 "./include/linux/linkage.h" #define CPP_ASMLINKAGE #endif # 20 "./include/linux/linkage.h" #ifndef asmlinkage #define asmlinkage CPP_ASMLINKAGE #endif # 24 "./include/linux/linkage.h" #ifndef cond_syscall #define cond_syscall(x) asm( \ ".weak " VMLINUX_SYMBOL_STR(x) "\n\t" \ ".set " VMLINUX_SYMBOL_STR(x) "," \ VMLINUX_SYMBOL_STR(sys_ni_syscall)) #endif # 31 "./include/linux/linkage.h" #ifndef SYSCALL_ALIAS #define SYSCALL_ALIAS(alias, name) asm( \ ".globl " VMLINUX_SYMBOL_STR(alias) "\n\t" \ ".set " VMLINUX_SYMBOL_STR(alias) "," \ VMLINUX_SYMBOL_STR(name)) #endif # 38 "./include/linux/linkage.h" #define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE) #define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE) /* * For assembly routines. * * Note when using these that you must specify the appropriate * alignment directives yourself */ #define __PAGE_ALIGNED_DATA .section ".data..page_aligned", "aw" #define __PAGE_ALIGNED_BSS .section ".bss..page_aligned", "aw" /* * This is used by architectures to keep arguments on the stack * untouched by the compiler by keeping them live until the end. * The argument stack may be owned by the assembly-language * caller, not the callee, and gcc doesn't always understand * that. * * We have the return value, and a maximum of six arguments. * * This should always be followed by a "return ret" for the * protection to work (ie no more work that the compiler might * end up needing stack temporaries for). */ /* Assembly files may be compiled with -traditional .. */ #ifndef __ASSEMBLY__ #ifndef asmlinkage_protect # define asmlinkage_protect(n, ret, args...) do { } while (0) #endif # 69 "./include/linux/linkage.h" #endif # 70 "./include/linux/linkage.h" #ifndef __ALIGN #define __ALIGN .align 4,0x90 #define __ALIGN_STR ".align 4,0x90" #endif # 75 "./include/linux/linkage.h" #ifdef __ASSEMBLY__ #ifndef LINKER_SCRIPT #define ALIGN __ALIGN #define ALIGN_STR __ALIGN_STR #ifndef ENTRY #define ENTRY(name) \ .globl name ASM_NL \ ALIGN ASM_NL \ name: #endif # 88 "./include/linux/linkage.h" #endif /* LINKER_SCRIPT */ # 89 "./include/linux/linkage.h" #ifndef WEAK #define WEAK(name) \ .weak name ASM_NL \ name: #endif # 95 "./include/linux/linkage.h" #ifndef END #define END(name) \ .size name, .-name #endif # 100 "./include/linux/linkage.h" /* If symbol 'name' is treated as a subroutine (gets called, and returns) * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of * static analysis tools such as stack depth analyzer. */ #ifndef ENDPROC #define ENDPROC(name) \ .type name, @function ASM_NL \ END(name) #endif # 110 "./include/linux/linkage.h" #endif # 112 "./include/linux/linkage.h" #endif # 114 "./include/linux/linkage.h" # 8 "./include/linux/kernel.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 8 "./include/linux/kernel.h" # 9 "./include/linux/kernel.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 9 "./include/linux/kernel.h" # 10 "./include/linux/kernel.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 10 "./include/linux/kernel.h" # 11 "./include/linux/kernel.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 11 "./include/linux/kernel.h" # 1 "./include/linux/bitops.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_BITOPS_H #define _LINUX_BITOPS_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 4 "./include/linux/bitops.h" # 5 "./include/linux/bitops.h" #ifdef __KERNEL__ #define BIT(nr) (1UL << (nr)) #define BIT_ULL(nr) (1ULL << (nr)) #define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) #define BIT_ULL_MASK(nr) (1ULL << ((nr) % BITS_PER_LONG_LONG)) #define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG) #define BITS_PER_BYTE 8 #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) #endif # 16 "./include/linux/bitops.h" /* * Create a contiguous bitmask starting at bit position @l and ending at * position @h. For example * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. */ #define GENMASK(h, l) \ (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) #define GENMASK_ULL(h, l) \ (((~0ULL) - (1ULL << (l)) + 1) & \ (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) extern unsigned int __sw_hweight8(unsigned int w); extern unsigned int __sw_hweight16(unsigned int w); extern unsigned int __sw_hweight32(unsigned int w); extern unsigned long __sw_hweight64(__u64 w); /* * Include this here because some architectures need generic_ffs/fls in * scope */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "./include/linux/bitops.h" # 1 "./arch/x86/include/asm/bitops.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_BITOPS_H #define _ASM_X86_BITOPS_H /* * Copyright 1992, Linus Torvalds. * * Note: inlines with more than a single statement should be marked * __always_inline to avoid problems with older gcc's inlining heuristics. */ #ifndef _LINUX_BITOPS_H #error only can be included directly #endif # 15 "./arch/x86/include/asm/bitops.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 16 "./arch/x86/include/asm/bitops.h" # 17 "./arch/x86/include/asm/bitops.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 17 "./arch/x86/include/asm/bitops.h" # 18 "./arch/x86/include/asm/bitops.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 18 "./arch/x86/include/asm/bitops.h" # 1 "./arch/x86/include/asm/rmwcc.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_RMWcc #define _ASM_X86_RMWcc #define __CLOBBERS_MEM "memory" #define __CLOBBERS_MEM_CC_CX "memory", "cc", "cx" #if !defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(CC_HAVE_ASM_GOTO) /* Use asm goto */ #define __GEN_RMWcc(fullop, var, cc, clobbers, ...) \ do { \ asm_volatile_goto (fullop "; j" #cc " %l[cc_label]" \ : : [counter] "m" (var), ## __VA_ARGS__ \ : clobbers : cc_label); \ return 0; \ cc_label: \ return 1; \ } while (0) #define __BINARY_RMWcc_ARG " %1, " #else /* defined(__GCC_ASM_FLAG_OUTPUTS__) || !defined(CC_HAVE_ASM_GOTO) */ # 26 "./arch/x86/include/asm/rmwcc.h" /* Use flags output or a set instruction */ #define __GEN_RMWcc(fullop, var, cc, clobbers, ...) \ do { \ bool c; \ asm volatile (fullop CC_SET(cc) \ : [counter] "+m" (var), CC_OUT(cc) (c) \ : __VA_ARGS__ : clobbers); \ return c; \ } while (0) #define __BINARY_RMWcc_ARG " %2, " #endif /* defined(__GCC_ASM_FLAG_OUTPUTS__) || !defined(CC_HAVE_ASM_GOTO) */ # 41 "./arch/x86/include/asm/rmwcc.h" #define GEN_UNARY_RMWcc(op, var, arg0, cc) \ __GEN_RMWcc(op " " arg0, var, cc, __CLOBBERS_MEM) #define GEN_UNARY_SUFFIXED_RMWcc(op, suffix, var, arg0, cc) \ __GEN_RMWcc(op " " arg0 "\n\t" suffix, var, cc, \ __CLOBBERS_MEM_CC_CX) #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \ __GEN_RMWcc(op __BINARY_RMWcc_ARG arg0, var, cc, \ __CLOBBERS_MEM, vcon (val)) #define GEN_BINARY_SUFFIXED_RMWcc(op, suffix, var, vcon, val, arg0, cc) \ __GEN_RMWcc(op __BINARY_RMWcc_ARG arg0 "\n\t" suffix, var, cc, \ __CLOBBERS_MEM_CC_CX, vcon (val)) #endif /* _ASM_X86_RMWcc */ # 58 "./arch/x86/include/asm/rmwcc.h" # 19 "./arch/x86/include/asm/bitops.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 19 "./arch/x86/include/asm/bitops.h" # 20 "./arch/x86/include/asm/bitops.h" #if BITS_PER_LONG == 32 # define _BITOPS_LONG_SHIFT 5 #elif BITS_PER_LONG == 64 # 24 "./arch/x86/include/asm/bitops.h" # define _BITOPS_LONG_SHIFT 6 #else # 26 "./arch/x86/include/asm/bitops.h" # error "Unexpected BITS_PER_LONG" #endif # 28 "./arch/x86/include/asm/bitops.h" #define BIT_64(n) (U64_C(1) << (n)) /* * These have to be done with inline assembly: that way the bit-setting * is guaranteed to be atomic. All bit operations return 0 if the bit * was cleared before the operation and != 0 if it was not. * * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). */ #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1) /* Technically wrong, but this avoids compilation errors on some gcc versions. */ #define BITOP_ADDR(x) "=m" (*(volatile long *) (x)) #else # 44 "./arch/x86/include/asm/bitops.h" #define BITOP_ADDR(x) "+m" (*(volatile long *) (x)) #endif # 46 "./arch/x86/include/asm/bitops.h" #define ADDR BITOP_ADDR(addr) /* * We do the locked ops that don't return the old value as * a mask operation on a byte. */ #define IS_IMMEDIATE(nr) (__builtin_constant_p(nr)) #define CONST_MASK_ADDR(nr, addr) BITOP_ADDR((void *)(addr) + ((nr)>>3)) #define CONST_MASK(nr) (1 << ((nr) & 7)) /** * set_bit - Atomically set a bit in memory * @nr: the bit to set * @addr: the address to start counting from * * This function is atomic and may not be reordered. See __set_bit() * if you do not require the atomic guarantees. * * Note: there are no guarantees that this function will not be reordered * on non x86 architectures, so if you are writing portable code, * make sure not to rely on its reordering guarantees. * * Note that @nr may be almost arbitrarily large; this function is not * restricted to acting on a single-word quantity. */ static __always_inline void set_bit(long nr, volatile unsigned long *addr) { if (IS_IMMEDIATE(nr)) { asm volatile(LOCK_PREFIX "orb %1,%0" : CONST_MASK_ADDR(nr, addr) : "iq" ((u8)CONST_MASK(nr)) : "memory"); } else { asm volatile(LOCK_PREFIX "bts %1,%0" : BITOP_ADDR(addr) : "Ir" (nr) : "memory"); } } /** * __set_bit - Set a bit in memory * @nr: the bit to set * @addr: the address to start counting from * * Unlike set_bit(), this function is non-atomic and may be reordered. * If it's called on the same region of memory simultaneously, the effect * may be that only one operation succeeds. */ static __always_inline void __set_bit(long nr, volatile unsigned long *addr) { asm volatile("bts %1,%0" : ADDR : "Ir" (nr) : "memory"); } /** * clear_bit - Clears a bit in memory * @nr: Bit to clear * @addr: Address to start counting from * * clear_bit() is atomic and may not be reordered. However, it does * not contain a memory barrier, so if it is used for locking purposes, * you should call smp_mb__before_atomic() and/or smp_mb__after_atomic() * in order to ensure changes are visible on other processors. */ static __always_inline void clear_bit(long nr, volatile unsigned long *addr) { if (IS_IMMEDIATE(nr)) { asm volatile(LOCK_PREFIX "andb %1,%0" : CONST_MASK_ADDR(nr, addr) : "iq" ((u8)~CONST_MASK(nr))); } else { asm volatile(LOCK_PREFIX "btr %1,%0" : BITOP_ADDR(addr) : "Ir" (nr)); } } /* * clear_bit_unlock - Clears a bit in memory * @nr: Bit to clear * @addr: Address to start counting from * * clear_bit() is atomic and implies release semantics before the memory * operation. It can be used for an unlock. */ static __always_inline void clear_bit_unlock(long nr, volatile unsigned long *addr) { barrier(); clear_bit(nr, addr); } static __always_inline void __clear_bit(long nr, volatile unsigned long *addr) { asm volatile("btr %1,%0" : ADDR : "Ir" (nr)); } static __always_inline bool clear_bit_unlock_is_negative_byte(long nr, volatile unsigned long *addr) { bool negative; asm volatile(LOCK_PREFIX "andb %2,%1" CC_SET(s) : CC_OUT(s) (negative), ADDR : "ir" ((char) ~(1 << nr)) : "memory"); return negative; } // Let everybody know we have it #define clear_bit_unlock_is_negative_byte clear_bit_unlock_is_negative_byte /* * __clear_bit_unlock - Clears a bit in memory * @nr: Bit to clear * @addr: Address to start counting from * * __clear_bit() is non-atomic and implies release semantics before the memory * operation. It can be used for an unlock if no other CPUs can concurrently * modify other bits in the word. * * No memory barrier is required here, because x86 cannot reorder stores past * older loads. Same principle as spin_unlock. */ static __always_inline void __clear_bit_unlock(long nr, volatile unsigned long *addr) { barrier(); __clear_bit(nr, addr); } /** * __change_bit - Toggle a bit in memory * @nr: the bit to change * @addr: the address to start counting from * * Unlike change_bit(), this function is non-atomic and may be reordered. * If it's called on the same region of memory simultaneously, the effect * may be that only one operation succeeds. */ static __always_inline void __change_bit(long nr, volatile unsigned long *addr) { asm volatile("btc %1,%0" : ADDR : "Ir" (nr)); } /** * change_bit - Toggle a bit in memory * @nr: Bit to change * @addr: Address to start counting from * * change_bit() is atomic and may not be reordered. * Note that @nr may be almost arbitrarily large; this function is not * restricted to acting on a single-word quantity. */ static __always_inline void change_bit(long nr, volatile unsigned long *addr) { if (IS_IMMEDIATE(nr)) { asm volatile(LOCK_PREFIX "xorb %1,%0" : CONST_MASK_ADDR(nr, addr) : "iq" ((u8)CONST_MASK(nr))); } else { asm volatile(LOCK_PREFIX "btc %1,%0" : BITOP_ADDR(addr) : "Ir" (nr)); } } /** * test_and_set_bit - Set a bit and return its old value * @nr: Bit to set * @addr: Address to count from * * This operation is atomic and cannot be reordered. * It also implies a memory barrier. */ static __always_inline bool test_and_set_bit(long nr, volatile unsigned long *addr) { GEN_BINARY_RMWcc(LOCK_PREFIX "bts", *addr, "Ir", nr, "%0", c); } /** * test_and_set_bit_lock - Set a bit and return its old value for lock * @nr: Bit to set * @addr: Address to count from * * This is the same as test_and_set_bit on x86. */ static __always_inline bool test_and_set_bit_lock(long nr, volatile unsigned long *addr) { return test_and_set_bit(nr, addr); } /** * __test_and_set_bit - Set a bit and return its old value * @nr: Bit to set * @addr: Address to count from * * This operation is non-atomic and can be reordered. * If two examples of this operation race, one can appear to succeed * but actually fail. You must protect multiple accesses with a lock. */ static __always_inline bool __test_and_set_bit(long nr, volatile unsigned long *addr) { bool oldbit; asm("bts %2,%1" CC_SET(c) : CC_OUT(c) (oldbit), ADDR : "Ir" (nr)); return oldbit; } /** * test_and_clear_bit - Clear a bit and return its old value * @nr: Bit to clear * @addr: Address to count from * * This operation is atomic and cannot be reordered. * It also implies a memory barrier. */ static __always_inline bool test_and_clear_bit(long nr, volatile unsigned long *addr) { GEN_BINARY_RMWcc(LOCK_PREFIX "btr", *addr, "Ir", nr, "%0", c); } /** * __test_and_clear_bit - Clear a bit and return its old value * @nr: Bit to clear * @addr: Address to count from * * This operation is non-atomic and can be reordered. * If two examples of this operation race, one can appear to succeed * but actually fail. You must protect multiple accesses with a lock. * * Note: the operation is performed atomically with respect to * the local CPU, but not other CPUs. Portable code should not * rely on this behaviour. * KVM relies on this behaviour on x86 for modifying memory that is also * accessed from a hypervisor on the same CPU if running in a VM: don't change * this without also updating arch/x86/kernel/kvm.c */ static __always_inline bool __test_and_clear_bit(long nr, volatile unsigned long *addr) { bool oldbit; asm volatile("btr %2,%1" CC_SET(c) : CC_OUT(c) (oldbit), ADDR : "Ir" (nr)); return oldbit; } /* WARNING: non atomic and it can be reordered! */ static __always_inline bool __test_and_change_bit(long nr, volatile unsigned long *addr) { bool oldbit; asm volatile("btc %2,%1" CC_SET(c) : CC_OUT(c) (oldbit), ADDR : "Ir" (nr) : "memory"); return oldbit; } /** * test_and_change_bit - Change a bit and return its old value * @nr: Bit to change * @addr: Address to count from * * This operation is atomic and cannot be reordered. * It also implies a memory barrier. */ static __always_inline bool test_and_change_bit(long nr, volatile unsigned long *addr) { GEN_BINARY_RMWcc(LOCK_PREFIX "btc", *addr, "Ir", nr, "%0", c); } static __always_inline bool constant_test_bit(long nr, const volatile unsigned long *addr) { return ((1UL << (nr & (BITS_PER_LONG-1))) & (addr[nr >> _BITOPS_LONG_SHIFT])) != 0; } static __always_inline bool variable_test_bit(long nr, volatile const unsigned long *addr) { bool oldbit; asm volatile("bt %2,%1" CC_SET(c) : CC_OUT(c) (oldbit) : "m" (*(unsigned long *)addr), "Ir" (nr)); return oldbit; } #if 0 /* Fool kernel-doc since it doesn't do macros yet */ /** * test_bit - Determine whether a bit is set * @nr: bit number to test * @addr: Address to start counting from */ static bool test_bit(int nr, const volatile unsigned long *addr); #endif # 348 "./arch/x86/include/asm/bitops.h" #define test_bit(nr, addr) \ (__builtin_constant_p((nr)) \ ? constant_test_bit((nr), (addr)) \ : variable_test_bit((nr), (addr))) /** * __ffs - find first set bit in word * @word: The word to search * * Undefined if no bit exists, so code should check against 0 first. */ static __always_inline unsigned long __ffs(unsigned long word) { asm("rep; bsf %1,%0" : "=r" (word) : "rm" (word)); return word; } /** * ffz - find first zero bit in word * @word: The word to search * * Undefined if no zero exists, so code should check against ~0UL first. */ static __always_inline unsigned long ffz(unsigned long word) { asm("rep; bsf %1,%0" : "=r" (word) : "r" (~word)); return word; } /* * __fls: find last set bit in word * @word: The word to search * * Undefined if no set bit exists, so code should check against 0 first. */ static __always_inline unsigned long __fls(unsigned long word) { asm("bsr %1,%0" : "=r" (word) : "rm" (word)); return word; } #undef ADDR #ifdef __KERNEL__ /** * ffs - find first set bit in word * @x: the word to search * * This is defined the same way as the libc and compiler builtin ffs * routines, therefore differs in spirit from the other bitops. * * ffs(value) returns 0 if value is 0 or the position of the first * set bit if value is nonzero. The first (least significant) bit * is at position 1. */ static __always_inline int ffs(int x) { int r; #ifdef CONFIG_X86_64 /* * AMD64 says BSFL won't clobber the dest reg if x==0; Intel64 says the * dest reg is undefined if x==0, but their CPU architect says its * value is written to set it to the same as before, except that the * top 32 bits will be cleared. * * We cannot do this on 32 bits because at the very least some * 486 CPUs did not behave this way. */ asm("bsfl %1,%0" : "=r" (r) : "rm" (x), "0" (-1)); #elif defined(CONFIG_X86_CMOV) # 428 "./arch/x86/include/asm/bitops.h" asm("bsfl %1,%0\n\t" "cmovzl %2,%0" : "=&r" (r) : "rm" (x), "r" (-1)); #else # 432 "./arch/x86/include/asm/bitops.h" asm("bsfl %1,%0\n\t" "jnz 1f\n\t" "movl $-1,%0\n" "1:" : "=r" (r) : "rm" (x)); #endif # 437 "./arch/x86/include/asm/bitops.h" return r + 1; } /** * fls - find last set bit in word * @x: the word to search * * This is defined in a similar way as the libc and compiler builtin * ffs, but returns the position of the most significant set bit. * * fls(value) returns 0 if value is 0 or the position of the last * set bit if value is nonzero. The last (most significant) bit is * at position 32. */ static __always_inline int fls(int x) { int r; #ifdef CONFIG_X86_64 /* * AMD64 says BSRL won't clobber the dest reg if x==0; Intel64 says the * dest reg is undefined if x==0, but their CPU architect says its * value is written to set it to the same as before, except that the * top 32 bits will be cleared. * * We cannot do this on 32 bits because at the very least some * 486 CPUs did not behave this way. */ asm("bsrl %1,%0" : "=r" (r) : "rm" (x), "0" (-1)); #elif defined(CONFIG_X86_CMOV) # 469 "./arch/x86/include/asm/bitops.h" asm("bsrl %1,%0\n\t" "cmovzl %2,%0" : "=&r" (r) : "rm" (x), "rm" (-1)); #else # 473 "./arch/x86/include/asm/bitops.h" asm("bsrl %1,%0\n\t" "jnz 1f\n\t" "movl $-1,%0\n" "1:" : "=r" (r) : "rm" (x)); #endif # 478 "./arch/x86/include/asm/bitops.h" return r + 1; } /** * fls64 - find last set bit in a 64-bit word * @x: the word to search * * This is defined in a similar way as the libc and compiler builtin * ffsll, but returns the position of the most significant set bit. * * fls64(value) returns 0 if value is 0 or the position of the last * set bit if value is nonzero. The last (most significant) bit is * at position 64. */ #ifdef CONFIG_X86_64 static __always_inline int fls64(__u64 x) { int bitpos = -1; /* * AMD64 says BSRQ won't clobber the dest reg if x==0; Intel64 says the * dest reg is undefined if x==0, but their CPU architect says its * value is written to set it to the same as before. */ asm("bsrq %1,%q0" : "+r" (bitpos) : "rm" (x)); return bitpos + 1; } #else # 507 "./arch/x86/include/asm/bitops.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 507 "./arch/x86/include/asm/bitops.h" # 1 "./include/asm-generic/bitops/fls64.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_GENERIC_BITOPS_FLS64_H_ #define _ASM_GENERIC_BITOPS_FLS64_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/asm-generic/bitops/fls64.h" # 6 "./include/asm-generic/bitops/fls64.h" /** * fls64 - find last set bit in a 64-bit word * @x: the word to search * * This is defined in a similar way as the libc and compiler builtin * ffsll, but returns the position of the most significant set bit. * * fls64(value) returns 0 if value is 0 or the position of the last * set bit if value is nonzero. The last (most significant) bit is * at position 64. */ #if BITS_PER_LONG == 32 static __always_inline int fls64(__u64 x) { __u32 h = x >> 32; if (h) return fls(h) + 32; return fls(x); } #elif BITS_PER_LONG == 64 # 27 "./include/asm-generic/bitops/fls64.h" static __always_inline int fls64(__u64 x) { if (x == 0) return 0; return __fls(x) + 1; } #else # 34 "./include/asm-generic/bitops/fls64.h" #error BITS_PER_LONG not 32 or 64 #endif # 36 "./include/asm-generic/bitops/fls64.h" #endif /* _ASM_GENERIC_BITOPS_FLS64_H_ */ # 38 "./include/asm-generic/bitops/fls64.h" # 508 "./arch/x86/include/asm/bitops.h" 2 #endif # 509 "./arch/x86/include/asm/bitops.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 510 "./arch/x86/include/asm/bitops.h" # 1 "./include/asm-generic/bitops/find.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_GENERIC_BITOPS_FIND_H_ #define _ASM_GENERIC_BITOPS_FIND_H_ #ifndef find_next_bit /** * find_next_bit - find the next set bit in a memory region * @addr: The address to base the search on * @offset: The bitnumber to start searching at * @size: The bitmap size in bits * * Returns the bit number for the next set bit * If no bits are set, returns @size. */ extern unsigned long find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset); #endif # 18 "./include/asm-generic/bitops/find.h" #ifndef find_next_zero_bit /** * find_next_zero_bit - find the next cleared bit in a memory region * @addr: The address to base the search on * @offset: The bitnumber to start searching at * @size: The bitmap size in bits * * Returns the bit number of the next zero bit * If no bits are zero, returns @size. */ extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, unsigned long offset); #endif # 32 "./include/asm-generic/bitops/find.h" #ifdef CONFIG_GENERIC_FIND_FIRST_BIT /** * find_first_bit - find the first set bit in a memory region * @addr: The address to start the search at * @size: The maximum number of bits to search * * Returns the bit number of the first set bit. * If no bits are set, returns @size. */ extern unsigned long find_first_bit(const unsigned long *addr, unsigned long size); /** * find_first_zero_bit - find the first cleared bit in a memory region * @addr: The address to start the search at * @size: The maximum number of bits to search * * Returns the bit number of the first cleared bit. * If no bits are zero, returns @size. */ extern unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size); #else /* CONFIG_GENERIC_FIND_FIRST_BIT */ # 57 "./include/asm-generic/bitops/find.h" #define find_first_bit(addr, size) find_next_bit((addr), (size), 0) #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ # 62 "./include/asm-generic/bitops/find.h" #endif /*_ASM_GENERIC_BITOPS_FIND_H_ */ # 64 "./include/asm-generic/bitops/find.h" # 511 "./arch/x86/include/asm/bitops.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 512 "./arch/x86/include/asm/bitops.h" # 1 "./include/asm-generic/bitops/sched.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_GENERIC_BITOPS_SCHED_H_ #define _ASM_GENERIC_BITOPS_SCHED_H_ #if 0 /* expanded by -frewrite-includes */ #include /* unlikely() */ #endif /* expanded by -frewrite-includes */ # 5 "./include/asm-generic/bitops/sched.h" # 6 "./include/asm-generic/bitops/sched.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./include/asm-generic/bitops/sched.h" # 7 "./include/asm-generic/bitops/sched.h" /* * Every architecture must define this function. It's the fastest * way of searching a 100-bit bitmap. It's guaranteed that at least * one of the 100 bits is cleared. */ static inline int sched_find_first_bit(const unsigned long *b) { #if BITS_PER_LONG == 64 if (b[0]) return __ffs(b[0]); return __ffs(b[1]) + 64; #elif BITS_PER_LONG == 32 # 20 "./include/asm-generic/bitops/sched.h" if (b[0]) return __ffs(b[0]); if (b[1]) return __ffs(b[1]) + 32; if (b[2]) return __ffs(b[2]) + 64; return __ffs(b[3]) + 96; #else # 28 "./include/asm-generic/bitops/sched.h" #error BITS_PER_LONG not defined #endif # 30 "./include/asm-generic/bitops/sched.h" } #endif /* _ASM_GENERIC_BITOPS_SCHED_H_ */ # 33 "./include/asm-generic/bitops/sched.h" # 513 "./arch/x86/include/asm/bitops.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 514 "./arch/x86/include/asm/bitops.h" # 1 "./arch/x86/include/asm/arch_hweight.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_HWEIGHT_H #define _ASM_X86_HWEIGHT_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./arch/x86/include/asm/arch_hweight.h" # 1 "./arch/x86/include/asm/cpufeatures.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_CPUFEATURES_H #define _ASM_X86_CPUFEATURES_H #ifndef _ASM_X86_REQUIRED_FEATURES_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./arch/x86/include/asm/cpufeatures.h" # 1 "./arch/x86/include/asm/required-features.h" 1 #ifndef _ASM_X86_REQUIRED_FEATURES_H #define _ASM_X86_REQUIRED_FEATURES_H /* Define minimum CPUID feature set for kernel These bits are checked really early to actually display a visible error message before the kernel dies. Make sure to assign features to the proper mask! Some requirements that are not in CPUID yet are also in the CONFIG_X86_MINIMUM_CPU_FAMILY which is checked too. The real information is in arch/x86/Kconfig.cpu, this just converts the CONFIGs into a bitmask */ #ifndef CONFIG_MATH_EMULATION # define NEED_FPU (1<<(X86_FEATURE_FPU & 31)) #else # 17 "./arch/x86/include/asm/required-features.h" # define NEED_FPU 0 #endif # 19 "./arch/x86/include/asm/required-features.h" #if defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64) # define NEED_PAE (1<<(X86_FEATURE_PAE & 31)) #else # 23 "./arch/x86/include/asm/required-features.h" # define NEED_PAE 0 #endif # 25 "./arch/x86/include/asm/required-features.h" #ifdef CONFIG_X86_CMPXCHG64 # define NEED_CX8 (1<<(X86_FEATURE_CX8 & 31)) #else # 29 "./arch/x86/include/asm/required-features.h" # define NEED_CX8 0 #endif # 31 "./arch/x86/include/asm/required-features.h" #if defined(CONFIG_X86_CMOV) || defined(CONFIG_X86_64) # define NEED_CMOV (1<<(X86_FEATURE_CMOV & 31)) #else # 35 "./arch/x86/include/asm/required-features.h" # define NEED_CMOV 0 #endif # 37 "./arch/x86/include/asm/required-features.h" #ifdef CONFIG_X86_USE_3DNOW # define NEED_3DNOW (1<<(X86_FEATURE_3DNOW & 31)) #else # 41 "./arch/x86/include/asm/required-features.h" # define NEED_3DNOW 0 #endif # 43 "./arch/x86/include/asm/required-features.h" #if defined(CONFIG_X86_P6_NOP) || defined(CONFIG_X86_64) # define NEED_NOPL (1<<(X86_FEATURE_NOPL & 31)) #else # 47 "./arch/x86/include/asm/required-features.h" # define NEED_NOPL 0 #endif # 49 "./arch/x86/include/asm/required-features.h" #ifdef CONFIG_MATOM # define NEED_MOVBE (1<<(X86_FEATURE_MOVBE & 31)) #else # 53 "./arch/x86/include/asm/required-features.h" # define NEED_MOVBE 0 #endif # 55 "./arch/x86/include/asm/required-features.h" #ifdef CONFIG_X86_5LEVEL # define NEED_LA57 (1<<(X86_FEATURE_LA57 & 31)) #else # 59 "./arch/x86/include/asm/required-features.h" # define NEED_LA57 0 #endif # 61 "./arch/x86/include/asm/required-features.h" #ifdef CONFIG_X86_64 #ifdef CONFIG_PARAVIRT /* Paravirtualized systems may not have PSE or PGE available */ #define NEED_PSE 0 #define NEED_PGE 0 #else # 68 "./arch/x86/include/asm/required-features.h" #define NEED_PSE (1<<(X86_FEATURE_PSE) & 31) #define NEED_PGE (1<<(X86_FEATURE_PGE) & 31) #endif # 71 "./arch/x86/include/asm/required-features.h" #define NEED_MSR (1<<(X86_FEATURE_MSR & 31)) #define NEED_FXSR (1<<(X86_FEATURE_FXSR & 31)) #define NEED_XMM (1<<(X86_FEATURE_XMM & 31)) #define NEED_XMM2 (1<<(X86_FEATURE_XMM2 & 31)) #define NEED_LM (1<<(X86_FEATURE_LM & 31)) #else # 77 "./arch/x86/include/asm/required-features.h" #define NEED_PSE 0 #define NEED_MSR 0 #define NEED_PGE 0 #define NEED_FXSR 0 #define NEED_XMM 0 #define NEED_XMM2 0 #define NEED_LM 0 #endif # 85 "./arch/x86/include/asm/required-features.h" #define REQUIRED_MASK0 (NEED_FPU|NEED_PSE|NEED_MSR|NEED_PAE|\ NEED_CX8|NEED_PGE|NEED_FXSR|NEED_CMOV|\ NEED_XMM|NEED_XMM2) #define SSE_MASK (NEED_XMM|NEED_XMM2) #define REQUIRED_MASK1 (NEED_LM|NEED_3DNOW) #define REQUIRED_MASK2 0 #define REQUIRED_MASK3 (NEED_NOPL) #define REQUIRED_MASK4 (NEED_MOVBE) #define REQUIRED_MASK5 0 #define REQUIRED_MASK6 0 #define REQUIRED_MASK7 0 #define REQUIRED_MASK8 0 #define REQUIRED_MASK9 0 #define REQUIRED_MASK10 0 #define REQUIRED_MASK11 0 #define REQUIRED_MASK12 0 #define REQUIRED_MASK13 0 #define REQUIRED_MASK14 0 #define REQUIRED_MASK15 0 #define REQUIRED_MASK16 (NEED_LA57) #define REQUIRED_MASK17 0 #define REQUIRED_MASK18 0 #define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 19) #endif /* _ASM_X86_REQUIRED_FEATURES_H */ # 113 "./arch/x86/include/asm/required-features.h" # 7 "./arch/x86/include/asm/cpufeatures.h" 2 #endif # 8 "./arch/x86/include/asm/cpufeatures.h" #ifndef _ASM_X86_DISABLED_FEATURES_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 10 "./arch/x86/include/asm/cpufeatures.h" # 1 "./arch/x86/include/asm/disabled-features.h" 1 #ifndef _ASM_X86_DISABLED_FEATURES_H #define _ASM_X86_DISABLED_FEATURES_H /* These features, although they might be available in a CPU * will not be used because the compile options to support * them are not present. * * This code allows them to be checked and disabled at * compile time without an explicit #ifdef. Use * cpu_feature_enabled(). */ #ifdef CONFIG_X86_INTEL_MPX # define DISABLE_MPX 0 #else # 16 "./arch/x86/include/asm/disabled-features.h" # define DISABLE_MPX (1<<(X86_FEATURE_MPX & 31)) #endif # 18 "./arch/x86/include/asm/disabled-features.h" #ifdef CONFIG_X86_INTEL_UMIP # define DISABLE_UMIP 0 #else # 22 "./arch/x86/include/asm/disabled-features.h" # define DISABLE_UMIP (1<<(X86_FEATURE_UMIP & 31)) #endif # 24 "./arch/x86/include/asm/disabled-features.h" #ifdef CONFIG_X86_64 # define DISABLE_VME (1<<(X86_FEATURE_VME & 31)) # define DISABLE_K6_MTRR (1<<(X86_FEATURE_K6_MTRR & 31)) # define DISABLE_CYRIX_ARR (1<<(X86_FEATURE_CYRIX_ARR & 31)) # define DISABLE_CENTAUR_MCR (1<<(X86_FEATURE_CENTAUR_MCR & 31)) # define DISABLE_PCID 0 #else # 32 "./arch/x86/include/asm/disabled-features.h" # define DISABLE_VME 0 # define DISABLE_K6_MTRR 0 # define DISABLE_CYRIX_ARR 0 # define DISABLE_CENTAUR_MCR 0 # define DISABLE_PCID (1<<(X86_FEATURE_PCID & 31)) #endif /* CONFIG_X86_64 */ # 38 "./arch/x86/include/asm/disabled-features.h" #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS # define DISABLE_PKU 0 # define DISABLE_OSPKE 0 #else # 43 "./arch/x86/include/asm/disabled-features.h" # define DISABLE_PKU (1<<(X86_FEATURE_PKU & 31)) # define DISABLE_OSPKE (1<<(X86_FEATURE_OSPKE & 31)) #endif /* CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS */ # 46 "./arch/x86/include/asm/disabled-features.h" #ifdef CONFIG_X86_5LEVEL # define DISABLE_LA57 0 #else # 50 "./arch/x86/include/asm/disabled-features.h" # define DISABLE_LA57 (1<<(X86_FEATURE_LA57 & 31)) #endif # 52 "./arch/x86/include/asm/disabled-features.h" #ifdef CONFIG_PAGE_TABLE_ISOLATION # define DISABLE_PTI 0 #else # 56 "./arch/x86/include/asm/disabled-features.h" # define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31)) #endif # 58 "./arch/x86/include/asm/disabled-features.h" /* * Make sure to add features to the correct mask */ #define DISABLED_MASK0 (DISABLE_VME) #define DISABLED_MASK1 0 #define DISABLED_MASK2 0 #define DISABLED_MASK3 (DISABLE_CYRIX_ARR|DISABLE_CENTAUR_MCR|DISABLE_K6_MTRR) #define DISABLED_MASK4 (DISABLE_PCID) #define DISABLED_MASK5 0 #define DISABLED_MASK6 0 #define DISABLED_MASK7 (DISABLE_PTI) #define DISABLED_MASK8 0 #define DISABLED_MASK9 (DISABLE_MPX) #define DISABLED_MASK10 0 #define DISABLED_MASK11 0 #define DISABLED_MASK12 0 #define DISABLED_MASK13 0 #define DISABLED_MASK14 0 #define DISABLED_MASK15 0 #define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP) #define DISABLED_MASK17 0 #define DISABLED_MASK18 0 #define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 19) #endif /* _ASM_X86_DISABLED_FEATURES_H */ # 84 "./arch/x86/include/asm/disabled-features.h" # 11 "./arch/x86/include/asm/cpufeatures.h" 2 #endif # 12 "./arch/x86/include/asm/cpufeatures.h" /* * Defines x86 CPU feature bits */ #define NCAPINTS 19 /* N 32-bit words worth of info */ #define NBUGINTS 1 /* N 32-bit bug flags */ /* * Note: If the comment begins with a quoted string, that string is used * in /proc/cpuinfo instead of the macro name. If the string is "", * this feature bit is not displayed in /proc/cpuinfo at all. * * When adding new features here that depend on other features, * please update the table in kernel/cpu/cpuid-deps.c as well. */ /* Intel-defined CPU features, CPUID level 0x00000001 (EDX), word 0 */ #define X86_FEATURE_FPU ( 0*32+ 0) /* Onboard FPU */ #define X86_FEATURE_VME ( 0*32+ 1) /* Virtual Mode Extensions */ #define X86_FEATURE_DE ( 0*32+ 2) /* Debugging Extensions */ #define X86_FEATURE_PSE ( 0*32+ 3) /* Page Size Extensions */ #define X86_FEATURE_TSC ( 0*32+ 4) /* Time Stamp Counter */ #define X86_FEATURE_MSR ( 0*32+ 5) /* Model-Specific Registers */ #define X86_FEATURE_PAE ( 0*32+ 6) /* Physical Address Extensions */ #define X86_FEATURE_MCE ( 0*32+ 7) /* Machine Check Exception */ #define X86_FEATURE_CX8 ( 0*32+ 8) /* CMPXCHG8 instruction */ #define X86_FEATURE_APIC ( 0*32+ 9) /* Onboard APIC */ #define X86_FEATURE_SEP ( 0*32+11) /* SYSENTER/SYSEXIT */ #define X86_FEATURE_MTRR ( 0*32+12) /* Memory Type Range Registers */ #define X86_FEATURE_PGE ( 0*32+13) /* Page Global Enable */ #define X86_FEATURE_MCA ( 0*32+14) /* Machine Check Architecture */ #define X86_FEATURE_CMOV ( 0*32+15) /* CMOV instructions (plus FCMOVcc, FCOMI with FPU) */ #define X86_FEATURE_PAT ( 0*32+16) /* Page Attribute Table */ #define X86_FEATURE_PSE36 ( 0*32+17) /* 36-bit PSEs */ #define X86_FEATURE_PN ( 0*32+18) /* Processor serial number */ #define X86_FEATURE_CLFLUSH ( 0*32+19) /* CLFLUSH instruction */ #define X86_FEATURE_DS ( 0*32+21) /* "dts" Debug Store */ #define X86_FEATURE_ACPI ( 0*32+22) /* ACPI via MSR */ #define X86_FEATURE_MMX ( 0*32+23) /* Multimedia Extensions */ #define X86_FEATURE_FXSR ( 0*32+24) /* FXSAVE/FXRSTOR, CR4.OSFXSR */ #define X86_FEATURE_XMM ( 0*32+25) /* "sse" */ #define X86_FEATURE_XMM2 ( 0*32+26) /* "sse2" */ #define X86_FEATURE_SELFSNOOP ( 0*32+27) /* "ss" CPU self snoop */ #define X86_FEATURE_HT ( 0*32+28) /* Hyper-Threading */ #define X86_FEATURE_ACC ( 0*32+29) /* "tm" Automatic clock control */ #define X86_FEATURE_IA64 ( 0*32+30) /* IA-64 processor */ #define X86_FEATURE_PBE ( 0*32+31) /* Pending Break Enable */ /* AMD-defined CPU features, CPUID level 0x80000001, word 1 */ /* Don't duplicate feature flags which are redundant with Intel! */ #define X86_FEATURE_SYSCALL ( 1*32+11) /* SYSCALL/SYSRET */ #define X86_FEATURE_MP ( 1*32+19) /* MP Capable */ #define X86_FEATURE_NX ( 1*32+20) /* Execute Disable */ #define X86_FEATURE_MMXEXT ( 1*32+22) /* AMD MMX extensions */ #define X86_FEATURE_FXSR_OPT ( 1*32+25) /* FXSAVE/FXRSTOR optimizations */ #define X86_FEATURE_GBPAGES ( 1*32+26) /* "pdpe1gb" GB pages */ #define X86_FEATURE_RDTSCP ( 1*32+27) /* RDTSCP */ #define X86_FEATURE_LM ( 1*32+29) /* Long Mode (x86-64, 64-bit support) */ #define X86_FEATURE_3DNOWEXT ( 1*32+30) /* AMD 3DNow extensions */ #define X86_FEATURE_3DNOW ( 1*32+31) /* 3DNow */ /* Transmeta-defined CPU features, CPUID level 0x80860001, word 2 */ #define X86_FEATURE_RECOVERY ( 2*32+ 0) /* CPU in recovery mode */ #define X86_FEATURE_LONGRUN ( 2*32+ 1) /* Longrun power control */ #define X86_FEATURE_LRTI ( 2*32+ 3) /* LongRun table interface */ /* Other features, Linux-defined mapping, word 3 */ /* This range is used for feature bits which conflict or are synthesized */ #define X86_FEATURE_CXMMX ( 3*32+ 0) /* Cyrix MMX extensions */ #define X86_FEATURE_K6_MTRR ( 3*32+ 1) /* AMD K6 nonstandard MTRRs */ #define X86_FEATURE_CYRIX_ARR ( 3*32+ 2) /* Cyrix ARRs (= MTRRs) */ #define X86_FEATURE_CENTAUR_MCR ( 3*32+ 3) /* Centaur MCRs (= MTRRs) */ /* CPU types for specific tunings: */ #define X86_FEATURE_K8 ( 3*32+ 4) /* "" Opteron, Athlon64 */ #define X86_FEATURE_K7 ( 3*32+ 5) /* "" Athlon */ #define X86_FEATURE_P3 ( 3*32+ 6) /* "" P3 */ #define X86_FEATURE_P4 ( 3*32+ 7) /* "" P4 */ #define X86_FEATURE_CONSTANT_TSC ( 3*32+ 8) /* TSC ticks at a constant rate */ #define X86_FEATURE_UP ( 3*32+ 9) /* SMP kernel running on UP */ #define X86_FEATURE_ART ( 3*32+10) /* Always running timer (ART) */ #define X86_FEATURE_ARCH_PERFMON ( 3*32+11) /* Intel Architectural PerfMon */ #define X86_FEATURE_PEBS ( 3*32+12) /* Precise-Event Based Sampling */ #define X86_FEATURE_BTS ( 3*32+13) /* Branch Trace Store */ #define X86_FEATURE_SYSCALL32 ( 3*32+14) /* "" syscall in IA32 userspace */ #define X86_FEATURE_SYSENTER32 ( 3*32+15) /* "" sysenter in IA32 userspace */ #define X86_FEATURE_REP_GOOD ( 3*32+16) /* REP microcode works well */ #define X86_FEATURE_MFENCE_RDTSC ( 3*32+17) /* "" MFENCE synchronizes RDTSC */ #define X86_FEATURE_LFENCE_RDTSC ( 3*32+18) /* "" LFENCE synchronizes RDTSC */ #define X86_FEATURE_ACC_POWER ( 3*32+19) /* AMD Accumulated Power Mechanism */ #define X86_FEATURE_NOPL ( 3*32+20) /* The NOPL (0F 1F) instructions */ #define X86_FEATURE_ALWAYS ( 3*32+21) /* "" Always-present feature */ #define X86_FEATURE_XTOPOLOGY ( 3*32+22) /* CPU topology enum extensions */ #define X86_FEATURE_TSC_RELIABLE ( 3*32+23) /* TSC is known to be reliable */ #define X86_FEATURE_NONSTOP_TSC ( 3*32+24) /* TSC does not stop in C states */ #define X86_FEATURE_CPUID ( 3*32+25) /* CPU has CPUID instruction itself */ #define X86_FEATURE_EXTD_APICID ( 3*32+26) /* Extended APICID (8 bits) */ #define X86_FEATURE_AMD_DCM ( 3*32+27) /* AMD multi-node processor */ #define X86_FEATURE_APERFMPERF ( 3*32+28) /* P-State hardware coordination feedback capability (APERF/MPERF MSRs) */ #define X86_FEATURE_NONSTOP_TSC_S3 ( 3*32+30) /* TSC doesn't stop in S3 state */ #define X86_FEATURE_TSC_KNOWN_FREQ ( 3*32+31) /* TSC has known frequency */ /* Intel-defined CPU features, CPUID level 0x00000001 (ECX), word 4 */ #define X86_FEATURE_XMM3 ( 4*32+ 0) /* "pni" SSE-3 */ #define X86_FEATURE_PCLMULQDQ ( 4*32+ 1) /* PCLMULQDQ instruction */ #define X86_FEATURE_DTES64 ( 4*32+ 2) /* 64-bit Debug Store */ #define X86_FEATURE_MWAIT ( 4*32+ 3) /* "monitor" MONITOR/MWAIT support */ #define X86_FEATURE_DSCPL ( 4*32+ 4) /* "ds_cpl" CPL-qualified (filtered) Debug Store */ #define X86_FEATURE_VMX ( 4*32+ 5) /* Hardware virtualization */ #define X86_FEATURE_SMX ( 4*32+ 6) /* Safer Mode eXtensions */ #define X86_FEATURE_EST ( 4*32+ 7) /* Enhanced SpeedStep */ #define X86_FEATURE_TM2 ( 4*32+ 8) /* Thermal Monitor 2 */ #define X86_FEATURE_SSSE3 ( 4*32+ 9) /* Supplemental SSE-3 */ #define X86_FEATURE_CID ( 4*32+10) /* Context ID */ #define X86_FEATURE_SDBG ( 4*32+11) /* Silicon Debug */ #define X86_FEATURE_FMA ( 4*32+12) /* Fused multiply-add */ #define X86_FEATURE_CX16 ( 4*32+13) /* CMPXCHG16B instruction */ #define X86_FEATURE_XTPR ( 4*32+14) /* Send Task Priority Messages */ #define X86_FEATURE_PDCM ( 4*32+15) /* Perf/Debug Capabilities MSR */ #define X86_FEATURE_PCID ( 4*32+17) /* Process Context Identifiers */ #define X86_FEATURE_DCA ( 4*32+18) /* Direct Cache Access */ #define X86_FEATURE_XMM4_1 ( 4*32+19) /* "sse4_1" SSE-4.1 */ #define X86_FEATURE_XMM4_2 ( 4*32+20) /* "sse4_2" SSE-4.2 */ #define X86_FEATURE_X2APIC ( 4*32+21) /* X2APIC */ #define X86_FEATURE_MOVBE ( 4*32+22) /* MOVBE instruction */ #define X86_FEATURE_POPCNT ( 4*32+23) /* POPCNT instruction */ #define X86_FEATURE_TSC_DEADLINE_TIMER ( 4*32+24) /* TSC deadline timer */ #define X86_FEATURE_AES ( 4*32+25) /* AES instructions */ #define X86_FEATURE_XSAVE ( 4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV instructions */ #define X86_FEATURE_OSXSAVE ( 4*32+27) /* "" XSAVE instruction enabled in the OS */ #define X86_FEATURE_AVX ( 4*32+28) /* Advanced Vector Extensions */ #define X86_FEATURE_F16C ( 4*32+29) /* 16-bit FP conversions */ #define X86_FEATURE_RDRAND ( 4*32+30) /* RDRAND instruction */ #define X86_FEATURE_HYPERVISOR ( 4*32+31) /* Running on a hypervisor */ /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ #define X86_FEATURE_XSTORE ( 5*32+ 2) /* "rng" RNG present (xstore) */ #define X86_FEATURE_XSTORE_EN ( 5*32+ 3) /* "rng_en" RNG enabled */ #define X86_FEATURE_XCRYPT ( 5*32+ 6) /* "ace" on-CPU crypto (xcrypt) */ #define X86_FEATURE_XCRYPT_EN ( 5*32+ 7) /* "ace_en" on-CPU crypto enabled */ #define X86_FEATURE_ACE2 ( 5*32+ 8) /* Advanced Cryptography Engine v2 */ #define X86_FEATURE_ACE2_EN ( 5*32+ 9) /* ACE v2 enabled */ #define X86_FEATURE_PHE ( 5*32+10) /* PadLock Hash Engine */ #define X86_FEATURE_PHE_EN ( 5*32+11) /* PHE enabled */ #define X86_FEATURE_PMM ( 5*32+12) /* PadLock Montgomery Multiplier */ #define X86_FEATURE_PMM_EN ( 5*32+13) /* PMM enabled */ /* More extended AMD flags: CPUID level 0x80000001, ECX, word 6 */ #define X86_FEATURE_LAHF_LM ( 6*32+ 0) /* LAHF/SAHF in long mode */ #define X86_FEATURE_CMP_LEGACY ( 6*32+ 1) /* If yes HyperThreading not valid */ #define X86_FEATURE_SVM ( 6*32+ 2) /* Secure Virtual Machine */ #define X86_FEATURE_EXTAPIC ( 6*32+ 3) /* Extended APIC space */ #define X86_FEATURE_CR8_LEGACY ( 6*32+ 4) /* CR8 in 32-bit mode */ #define X86_FEATURE_ABM ( 6*32+ 5) /* Advanced bit manipulation */ #define X86_FEATURE_SSE4A ( 6*32+ 6) /* SSE-4A */ #define X86_FEATURE_MISALIGNSSE ( 6*32+ 7) /* Misaligned SSE mode */ #define X86_FEATURE_3DNOWPREFETCH ( 6*32+ 8) /* 3DNow prefetch instructions */ #define X86_FEATURE_OSVW ( 6*32+ 9) /* OS Visible Workaround */ #define X86_FEATURE_IBS ( 6*32+10) /* Instruction Based Sampling */ #define X86_FEATURE_XOP ( 6*32+11) /* extended AVX instructions */ #define X86_FEATURE_SKINIT ( 6*32+12) /* SKINIT/STGI instructions */ #define X86_FEATURE_WDT ( 6*32+13) /* Watchdog timer */ #define X86_FEATURE_LWP ( 6*32+15) /* Light Weight Profiling */ #define X86_FEATURE_FMA4 ( 6*32+16) /* 4 operands MAC instructions */ #define X86_FEATURE_TCE ( 6*32+17) /* Translation Cache Extension */ #define X86_FEATURE_NODEID_MSR ( 6*32+19) /* NodeId MSR */ #define X86_FEATURE_TBM ( 6*32+21) /* Trailing Bit Manipulations */ #define X86_FEATURE_TOPOEXT ( 6*32+22) /* Topology extensions CPUID leafs */ #define X86_FEATURE_PERFCTR_CORE ( 6*32+23) /* Core performance counter extensions */ #define X86_FEATURE_PERFCTR_NB ( 6*32+24) /* NB performance counter extensions */ #define X86_FEATURE_BPEXT ( 6*32+26) /* Data breakpoint extension */ #define X86_FEATURE_PTSC ( 6*32+27) /* Performance time-stamp counter */ #define X86_FEATURE_PERFCTR_LLC ( 6*32+28) /* Last Level Cache performance counter extensions */ #define X86_FEATURE_MWAITX ( 6*32+29) /* MWAIT extension (MONITORX/MWAITX instructions) */ /* * Auxiliary flags: Linux defined - For features scattered in various * CPUID levels like 0x6, 0xA etc, word 7. * * Reuse free bits when adding new feature flags! */ #define X86_FEATURE_RING3MWAIT ( 7*32+ 0) /* Ring 3 MONITOR/MWAIT instructions */ #define X86_FEATURE_CPUID_FAULT ( 7*32+ 1) /* Intel CPUID faulting */ #define X86_FEATURE_CPB ( 7*32+ 2) /* AMD Core Performance Boost */ #define X86_FEATURE_EPB ( 7*32+ 3) /* IA32_ENERGY_PERF_BIAS support */ #define X86_FEATURE_CAT_L3 ( 7*32+ 4) /* Cache Allocation Technology L3 */ #define X86_FEATURE_CAT_L2 ( 7*32+ 5) /* Cache Allocation Technology L2 */ #define X86_FEATURE_CDP_L3 ( 7*32+ 6) /* Code and Data Prioritization L3 */ #define X86_FEATURE_INVPCID_SINGLE ( 7*32+ 7) /* Effectively INVPCID && CR4.PCIDE=1 */ #define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */ #define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */ #define X86_FEATURE_SME ( 7*32+10) /* AMD Secure Memory Encryption */ #define X86_FEATURE_PTI ( 7*32+11) /* Kernel Page Table Isolation enabled */ #define X86_FEATURE_RETPOLINE ( 7*32+12) /* "" Generic Retpoline mitigation for Spectre variant 2 */ #define X86_FEATURE_RETPOLINE_AMD ( 7*32+13) /* "" AMD Retpoline mitigation for Spectre variant 2 */ #define X86_FEATURE_INTEL_PPIN ( 7*32+14) /* Intel Processor Inventory Number */ #define X86_FEATURE_MBA ( 7*32+18) /* Memory Bandwidth Allocation */ #define X86_FEATURE_RSB_CTXSW ( 7*32+19) /* "" Fill RSB on context switches */ #define X86_FEATURE_USE_IBPB ( 7*32+21) /* "" Indirect Branch Prediction Barrier enabled */ #define X86_FEATURE_USE_IBRS_FW ( 7*32+22) /* "" Use IBRS during runtime firmware calls */ /* Virtualization flags: Linux defined, word 8 */ #define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */ #define X86_FEATURE_VNMI ( 8*32+ 1) /* Intel Virtual NMI */ #define X86_FEATURE_FLEXPRIORITY ( 8*32+ 2) /* Intel FlexPriority */ #define X86_FEATURE_EPT ( 8*32+ 3) /* Intel Extended Page Table */ #define X86_FEATURE_VPID ( 8*32+ 4) /* Intel Virtual Processor ID */ #define X86_FEATURE_VMMCALL ( 8*32+15) /* Prefer VMMCALL to VMCALL */ #define X86_FEATURE_XENPV ( 8*32+16) /* "" Xen paravirtual guest */ /* Intel-defined CPU features, CPUID level 0x00000007:0 (EBX), word 9 */ #define X86_FEATURE_FSGSBASE ( 9*32+ 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/ #define X86_FEATURE_TSC_ADJUST ( 9*32+ 1) /* TSC adjustment MSR 0x3B */ #define X86_FEATURE_BMI1 ( 9*32+ 3) /* 1st group bit manipulation extensions */ #define X86_FEATURE_HLE ( 9*32+ 4) /* Hardware Lock Elision */ #define X86_FEATURE_AVX2 ( 9*32+ 5) /* AVX2 instructions */ #define X86_FEATURE_SMEP ( 9*32+ 7) /* Supervisor Mode Execution Protection */ #define X86_FEATURE_BMI2 ( 9*32+ 8) /* 2nd group bit manipulation extensions */ #define X86_FEATURE_ERMS ( 9*32+ 9) /* Enhanced REP MOVSB/STOSB instructions */ #define X86_FEATURE_INVPCID ( 9*32+10) /* Invalidate Processor Context ID */ #define X86_FEATURE_RTM ( 9*32+11) /* Restricted Transactional Memory */ #define X86_FEATURE_CQM ( 9*32+12) /* Cache QoS Monitoring */ #define X86_FEATURE_MPX ( 9*32+14) /* Memory Protection Extension */ #define X86_FEATURE_RDT_A ( 9*32+15) /* Resource Director Technology Allocation */ #define X86_FEATURE_AVX512F ( 9*32+16) /* AVX-512 Foundation */ #define X86_FEATURE_AVX512DQ ( 9*32+17) /* AVX-512 DQ (Double/Quad granular) Instructions */ #define X86_FEATURE_RDSEED ( 9*32+18) /* RDSEED instruction */ #define X86_FEATURE_ADX ( 9*32+19) /* ADCX and ADOX instructions */ #define X86_FEATURE_SMAP ( 9*32+20) /* Supervisor Mode Access Prevention */ #define X86_FEATURE_AVX512IFMA ( 9*32+21) /* AVX-512 Integer Fused Multiply-Add instructions */ #define X86_FEATURE_CLFLUSHOPT ( 9*32+23) /* CLFLUSHOPT instruction */ #define X86_FEATURE_CLWB ( 9*32+24) /* CLWB instruction */ #define X86_FEATURE_INTEL_PT ( 9*32+25) /* Intel Processor Trace */ #define X86_FEATURE_AVX512PF ( 9*32+26) /* AVX-512 Prefetch */ #define X86_FEATURE_AVX512ER ( 9*32+27) /* AVX-512 Exponential and Reciprocal */ #define X86_FEATURE_AVX512CD ( 9*32+28) /* AVX-512 Conflict Detection */ #define X86_FEATURE_SHA_NI ( 9*32+29) /* SHA1/SHA256 Instruction Extensions */ #define X86_FEATURE_AVX512BW ( 9*32+30) /* AVX-512 BW (Byte/Word granular) Instructions */ #define X86_FEATURE_AVX512VL ( 9*32+31) /* AVX-512 VL (128/256 Vector Length) Extensions */ /* Extended state features, CPUID level 0x0000000d:1 (EAX), word 10 */ #define X86_FEATURE_XSAVEOPT (10*32+ 0) /* XSAVEOPT instruction */ #define X86_FEATURE_XSAVEC (10*32+ 1) /* XSAVEC instruction */ #define X86_FEATURE_XGETBV1 (10*32+ 2) /* XGETBV with ECX = 1 instruction */ #define X86_FEATURE_XSAVES (10*32+ 3) /* XSAVES/XRSTORS instructions */ /* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:0 (EDX), word 11 */ #define X86_FEATURE_CQM_LLC (11*32+ 1) /* LLC QoS if 1 */ /* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:1 (EDX), word 12 */ #define X86_FEATURE_CQM_OCCUP_LLC (12*32+ 0) /* LLC occupancy monitoring */ #define X86_FEATURE_CQM_MBM_TOTAL (12*32+ 1) /* LLC Total MBM monitoring */ #define X86_FEATURE_CQM_MBM_LOCAL (12*32+ 2) /* LLC Local MBM monitoring */ /* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13 */ #define X86_FEATURE_CLZERO (13*32+ 0) /* CLZERO instruction */ #define X86_FEATURE_IRPERF (13*32+ 1) /* Instructions Retired Count */ #define X86_FEATURE_XSAVEERPTR (13*32+ 2) /* Always save/restore FP error pointers */ #define X86_FEATURE_IBPB (13*32+12) /* Indirect Branch Prediction Barrier */ #define X86_FEATURE_IBRS (13*32+14) /* Indirect Branch Restricted Speculation */ #define X86_FEATURE_STIBP (13*32+15) /* Single Thread Indirect Branch Predictors */ /* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */ #define X86_FEATURE_DTHERM (14*32+ 0) /* Digital Thermal Sensor */ #define X86_FEATURE_IDA (14*32+ 1) /* Intel Dynamic Acceleration */ #define X86_FEATURE_ARAT (14*32+ 2) /* Always Running APIC Timer */ #define X86_FEATURE_PLN (14*32+ 4) /* Intel Power Limit Notification */ #define X86_FEATURE_PTS (14*32+ 6) /* Intel Package Thermal Status */ #define X86_FEATURE_HWP (14*32+ 7) /* Intel Hardware P-states */ #define X86_FEATURE_HWP_NOTIFY (14*32+ 8) /* HWP Notification */ #define X86_FEATURE_HWP_ACT_WINDOW (14*32+ 9) /* HWP Activity Window */ #define X86_FEATURE_HWP_EPP (14*32+10) /* HWP Energy Perf. Preference */ #define X86_FEATURE_HWP_PKG_REQ (14*32+11) /* HWP Package Level Request */ /* AMD SVM Feature Identification, CPUID level 0x8000000a (EDX), word 15 */ #define X86_FEATURE_NPT (15*32+ 0) /* Nested Page Table support */ #define X86_FEATURE_LBRV (15*32+ 1) /* LBR Virtualization support */ #define X86_FEATURE_SVML (15*32+ 2) /* "svm_lock" SVM locking MSR */ #define X86_FEATURE_NRIPS (15*32+ 3) /* "nrip_save" SVM next_rip save */ #define X86_FEATURE_TSCRATEMSR (15*32+ 4) /* "tsc_scale" TSC scaling support */ #define X86_FEATURE_VMCBCLEAN (15*32+ 5) /* "vmcb_clean" VMCB clean bits support */ #define X86_FEATURE_FLUSHBYASID (15*32+ 6) /* flush-by-ASID support */ #define X86_FEATURE_DECODEASSISTS (15*32+ 7) /* Decode Assists support */ #define X86_FEATURE_PAUSEFILTER (15*32+10) /* filtered pause intercept */ #define X86_FEATURE_PFTHRESHOLD (15*32+12) /* pause filter threshold */ #define X86_FEATURE_AVIC (15*32+13) /* Virtual Interrupt Controller */ #define X86_FEATURE_V_VMSAVE_VMLOAD (15*32+15) /* Virtual VMSAVE VMLOAD */ #define X86_FEATURE_VGIF (15*32+16) /* Virtual GIF */ /* Intel-defined CPU features, CPUID level 0x00000007:0 (ECX), word 16 */ #define X86_FEATURE_AVX512VBMI (16*32+ 1) /* AVX512 Vector Bit Manipulation instructions*/ #define X86_FEATURE_UMIP (16*32+ 2) /* User Mode Instruction Protection */ #define X86_FEATURE_PKU (16*32+ 3) /* Protection Keys for Userspace */ #define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */ #define X86_FEATURE_AVX512_VBMI2 (16*32+ 6) /* Additional AVX512 Vector Bit Manipulation Instructions */ #define X86_FEATURE_GFNI (16*32+ 8) /* Galois Field New Instructions */ #define X86_FEATURE_VAES (16*32+ 9) /* Vector AES */ #define X86_FEATURE_VPCLMULQDQ (16*32+10) /* Carry-Less Multiplication Double Quadword */ #define X86_FEATURE_AVX512_VNNI (16*32+11) /* Vector Neural Network Instructions */ #define X86_FEATURE_AVX512_BITALG (16*32+12) /* Support for VPOPCNT[B,W] and VPSHUF-BITQMB instructions */ #define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14) /* POPCNT for vectors of DW/QW */ #define X86_FEATURE_LA57 (16*32+16) /* 5-level page tables */ #define X86_FEATURE_RDPID (16*32+22) /* RDPID instruction */ /* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* MCA overflow recovery support */ #define X86_FEATURE_SUCCOR (17*32+ 1) /* Uncorrectable error containment and recovery */ #define X86_FEATURE_SMCA (17*32+ 3) /* Scalable MCA */ /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ #define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */ #define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */ #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ #define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */ #define X86_FEATURE_ARCH_CAPABILITIES (18*32+29) /* IA32_ARCH_CAPABILITIES MSR (Intel) */ /* * BUG word(s) */ #define X86_BUG(x) (NCAPINTS*32 + (x)) #define X86_BUG_F00F X86_BUG(0) /* Intel F00F */ #define X86_BUG_FDIV X86_BUG(1) /* FPU FDIV */ #define X86_BUG_COMA X86_BUG(2) /* Cyrix 6x86 coma */ #define X86_BUG_AMD_TLB_MMATCH X86_BUG(3) /* "tlb_mmatch" AMD Erratum 383 */ #define X86_BUG_AMD_APIC_C1E X86_BUG(4) /* "apic_c1e" AMD Erratum 400 */ #define X86_BUG_11AP X86_BUG(5) /* Bad local APIC aka 11AP */ #define X86_BUG_FXSAVE_LEAK X86_BUG(6) /* FXSAVE leaks FOP/FIP/FOP */ #define X86_BUG_CLFLUSH_MONITOR X86_BUG(7) /* AAI65, CLFLUSH required before MONITOR */ #define X86_BUG_SYSRET_SS_ATTRS X86_BUG(8) /* SYSRET doesn't fix up SS attrs */ #ifdef CONFIG_X86_32 /* * 64-bit kernels don't use X86_BUG_ESPFIX. Make the define conditional * to avoid confusion. */ #define X86_BUG_ESPFIX X86_BUG(9) /* "" IRET to 16-bit SS corrupts ESP/RSP high bits */ #endif # 354 "./arch/x86/include/asm/cpufeatures.h" #define X86_BUG_NULL_SEG X86_BUG(10) /* Nulling a selector preserves the base */ #define X86_BUG_SWAPGS_FENCE X86_BUG(11) /* SWAPGS without input dep on GS */ #define X86_BUG_MONITOR X86_BUG(12) /* IPI required to wake up remote CPU */ #define X86_BUG_AMD_E400 X86_BUG(13) /* CPU is among the affected by Erratum 400 */ #define X86_BUG_CPU_MELTDOWN X86_BUG(14) /* CPU is affected by meltdown attack and needs kernel page table isolation */ #define X86_BUG_SPECTRE_V1 X86_BUG(15) /* CPU is affected by Spectre variant 1 attack with conditional branches */ #define X86_BUG_SPECTRE_V2 X86_BUG(16) /* CPU is affected by Spectre variant 2 attack with indirect branches */ #endif /* _ASM_X86_CPUFEATURES_H */ # 363 "./arch/x86/include/asm/cpufeatures.h" # 6 "./arch/x86/include/asm/arch_hweight.h" 2 #ifdef CONFIG_64BIT /* popcnt %edi, %eax */ #define POPCNT32 ".byte 0xf3,0x0f,0xb8,0xc7" /* popcnt %rdi, %rax */ #define POPCNT64 ".byte 0xf3,0x48,0x0f,0xb8,0xc7" #define REG_IN "D" #define REG_OUT "a" #else # 15 "./arch/x86/include/asm/arch_hweight.h" /* popcnt %eax, %eax */ #define POPCNT32 ".byte 0xf3,0x0f,0xb8,0xc0" #define REG_IN "a" #define REG_OUT "a" #endif # 20 "./arch/x86/include/asm/arch_hweight.h" #define __HAVE_ARCH_SW_HWEIGHT static __always_inline unsigned int __arch_hweight32(unsigned int w) { unsigned int res; asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT) : "="REG_OUT (res) : REG_IN (w)); return res; } static inline unsigned int __arch_hweight16(unsigned int w) { return __arch_hweight32(w & 0xffff); } static inline unsigned int __arch_hweight8(unsigned int w) { return __arch_hweight32(w & 0xff); } #ifdef CONFIG_X86_32 static inline unsigned long __arch_hweight64(__u64 w) { return __arch_hweight32((u32)w) + __arch_hweight32((u32)(w >> 32)); } #else # 51 "./arch/x86/include/asm/arch_hweight.h" static __always_inline unsigned long __arch_hweight64(__u64 w) { unsigned long res; asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT) : "="REG_OUT (res) : REG_IN (w)); return res; } #endif /* CONFIG_X86_32 */ # 62 "./arch/x86/include/asm/arch_hweight.h" #endif # 64 "./arch/x86/include/asm/arch_hweight.h" # 515 "./arch/x86/include/asm/bitops.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 516 "./arch/x86/include/asm/bitops.h" # 1 "./include/asm-generic/bitops/const_hweight.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_ #define _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_ /* * Compile time versions of __arch_hweightN() */ #define __const_hweight8(w) \ ((unsigned int) \ ((!!((w) & (1ULL << 0))) + \ (!!((w) & (1ULL << 1))) + \ (!!((w) & (1ULL << 2))) + \ (!!((w) & (1ULL << 3))) + \ (!!((w) & (1ULL << 4))) + \ (!!((w) & (1ULL << 5))) + \ (!!((w) & (1ULL << 6))) + \ (!!((w) & (1ULL << 7))))) #define __const_hweight16(w) (__const_hweight8(w) + __const_hweight8((w) >> 8 )) #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16)) #define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32)) /* * Generic interface. */ #define hweight8(w) (__builtin_constant_p(w) ? __const_hweight8(w) : __arch_hweight8(w)) #define hweight16(w) (__builtin_constant_p(w) ? __const_hweight16(w) : __arch_hweight16(w)) #define hweight32(w) (__builtin_constant_p(w) ? __const_hweight32(w) : __arch_hweight32(w)) #define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w)) /* * Interface for known constant arguments */ #define HWEIGHT8(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight8(w)) #define HWEIGHT16(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight16(w)) #define HWEIGHT32(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight32(w)) #define HWEIGHT64(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight64(w)) /* * Type invariant interface to the compile time constant hweight functions. */ #define HWEIGHT(w) HWEIGHT64((u64)w) #endif /* _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_ */ # 45 "./include/asm-generic/bitops/const_hweight.h" # 517 "./arch/x86/include/asm/bitops.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 518 "./arch/x86/include/asm/bitops.h" # 1 "./include/asm-generic/bitops/le.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_GENERIC_BITOPS_LE_H_ #define _ASM_GENERIC_BITOPS_LE_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/asm-generic/bitops/le.h" # 6 "./include/asm-generic/bitops/le.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./include/asm-generic/bitops/le.h" # 1 "./arch/x86/include/uapi/asm/byteorder.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_BYTEORDER_H #define _ASM_X86_BYTEORDER_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./arch/x86/include/uapi/asm/byteorder.h" # 1 "./include/linux/byteorder/little_endian.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/linux/byteorder/little_endian.h" # 1 "./include/uapi/linux/byteorder/little_endian.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UAPI_LINUX_BYTEORDER_LITTLE_ENDIAN_H #define _UAPI_LINUX_BYTEORDER_LITTLE_ENDIAN_H #ifndef __LITTLE_ENDIAN #define __LITTLE_ENDIAN 1234 #endif # 8 "./include/uapi/linux/byteorder/little_endian.h" #ifndef __LITTLE_ENDIAN_BITFIELD #define __LITTLE_ENDIAN_BITFIELD #endif # 11 "./include/uapi/linux/byteorder/little_endian.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 12 "./include/uapi/linux/byteorder/little_endian.h" # 13 "./include/uapi/linux/byteorder/little_endian.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 13 "./include/uapi/linux/byteorder/little_endian.h" # 1 "./include/linux/swab.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_SWAB_H #define _LINUX_SWAB_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/linux/swab.h" # 1 "./include/uapi/linux/swab.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UAPI_LINUX_SWAB_H #define _UAPI_LINUX_SWAB_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/uapi/linux/swab.h" # 6 "./include/uapi/linux/swab.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./include/uapi/linux/swab.h" # 7 "./include/uapi/linux/swab.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 7 "./include/uapi/linux/swab.h" # 1 "./arch/x86/include/uapi/asm/swab.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_SWAB_H #define _ASM_X86_SWAB_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./arch/x86/include/uapi/asm/swab.h" # 6 "./arch/x86/include/uapi/asm/swab.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./arch/x86/include/uapi/asm/swab.h" # 7 "./arch/x86/include/uapi/asm/swab.h" static inline __attribute_const__ __u32 __arch_swab32(__u32 val) { asm("bswapl %0" : "=r" (val) : "0" (val)); return val; } #define __arch_swab32 __arch_swab32 static inline __attribute_const__ __u64 __arch_swab64(__u64 val) { #ifdef __i386__ union { struct { __u32 a; __u32 b; } s; __u64 u; } v; v.u = val; asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b)); return v.u; #else /* __i386__ */ # 31 "./arch/x86/include/uapi/asm/swab.h" asm("bswapq %0" : "=r" (val) : "0" (val)); return val; #endif # 34 "./arch/x86/include/uapi/asm/swab.h" } #define __arch_swab64 __arch_swab64 #endif /* _ASM_X86_SWAB_H */ # 38 "./arch/x86/include/uapi/asm/swab.h" # 8 "./include/uapi/linux/swab.h" 2 /* * casts are necessary for constants, because we never know how for sure * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way. */ #define ___constant_swab16(x) ((__u16)( \ (((__u16)(x) & (__u16)0x00ffU) << 8) | \ (((__u16)(x) & (__u16)0xff00U) >> 8))) #define ___constant_swab32(x) ((__u32)( \ (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \ (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \ (((__u32)(x) & (__u32)0xff000000UL) >> 24))) #define ___constant_swab64(x) ((__u64)( \ (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \ (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \ (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \ (((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \ (((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \ (((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \ (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \ (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56))) #define ___constant_swahw32(x) ((__u32)( \ (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \ (((__u32)(x) & (__u32)0xffff0000UL) >> 16))) #define ___constant_swahb32(x) ((__u32)( \ (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \ (((__u32)(x) & (__u32)0xff00ff00UL) >> 8))) /* * Implement the following as inlines, but define the interface using * macros to allow constant folding when possible: * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32 */ static inline __attribute_const__ __u16 __fswab16(__u16 val) { #if defined (__arch_swab16) return __arch_swab16(val); #else # 52 "./include/uapi/linux/swab.h" return ___constant_swab16(val); #endif # 54 "./include/uapi/linux/swab.h" } static inline __attribute_const__ __u32 __fswab32(__u32 val) { #if defined(__arch_swab32) return __arch_swab32(val); #else # 61 "./include/uapi/linux/swab.h" return ___constant_swab32(val); #endif # 63 "./include/uapi/linux/swab.h" } static inline __attribute_const__ __u64 __fswab64(__u64 val) { #if defined (__arch_swab64) return __arch_swab64(val); #elif defined(__SWAB_64_THRU_32__) # 70 "./include/uapi/linux/swab.h" __u32 h = val >> 32; __u32 l = val & ((1ULL << 32) - 1); return (((__u64)__fswab32(l)) << 32) | ((__u64)(__fswab32(h))); #else # 74 "./include/uapi/linux/swab.h" return ___constant_swab64(val); #endif # 76 "./include/uapi/linux/swab.h" } static inline __attribute_const__ __u32 __fswahw32(__u32 val) { #ifdef __arch_swahw32 return __arch_swahw32(val); #else # 83 "./include/uapi/linux/swab.h" return ___constant_swahw32(val); #endif # 85 "./include/uapi/linux/swab.h" } static inline __attribute_const__ __u32 __fswahb32(__u32 val) { #ifdef __arch_swahb32 return __arch_swahb32(val); #else # 92 "./include/uapi/linux/swab.h" return ___constant_swahb32(val); #endif # 94 "./include/uapi/linux/swab.h" } /** * __swab16 - return a byteswapped 16-bit value * @x: value to byteswap */ #ifdef __HAVE_BUILTIN_BSWAP16__ #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) #else # 103 "./include/uapi/linux/swab.h" #define __swab16(x) \ (__builtin_constant_p((__u16)(x)) ? \ ___constant_swab16(x) : \ __fswab16(x)) #endif # 108 "./include/uapi/linux/swab.h" /** * __swab32 - return a byteswapped 32-bit value * @x: value to byteswap */ #ifdef __HAVE_BUILTIN_BSWAP32__ #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) #else # 116 "./include/uapi/linux/swab.h" #define __swab32(x) \ (__builtin_constant_p((__u32)(x)) ? \ ___constant_swab32(x) : \ __fswab32(x)) #endif # 121 "./include/uapi/linux/swab.h" /** * __swab64 - return a byteswapped 64-bit value * @x: value to byteswap */ #ifdef __HAVE_BUILTIN_BSWAP64__ #define __swab64(x) (__u64)__builtin_bswap64((__u64)(x)) #else # 129 "./include/uapi/linux/swab.h" #define __swab64(x) \ (__builtin_constant_p((__u64)(x)) ? \ ___constant_swab64(x) : \ __fswab64(x)) #endif # 134 "./include/uapi/linux/swab.h" /** * __swahw32 - return a word-swapped 32-bit value * @x: value to wordswap * * __swahw32(0x12340000) is 0x00001234 */ #define __swahw32(x) \ (__builtin_constant_p((__u32)(x)) ? \ ___constant_swahw32(x) : \ __fswahw32(x)) /** * __swahb32 - return a high and low byte-swapped 32-bit value * @x: value to byteswap * * __swahb32(0x12345678) is 0x34127856 */ #define __swahb32(x) \ (__builtin_constant_p((__u32)(x)) ? \ ___constant_swahb32(x) : \ __fswahb32(x)) /** * __swab16p - return a byteswapped 16-bit value from a pointer * @p: pointer to a naturally-aligned 16-bit value */ static __always_inline __u16 __swab16p(const __u16 *p) { #ifdef __arch_swab16p return __arch_swab16p(p); #else # 166 "./include/uapi/linux/swab.h" return __swab16(*p); #endif # 168 "./include/uapi/linux/swab.h" } /** * __swab32p - return a byteswapped 32-bit value from a pointer * @p: pointer to a naturally-aligned 32-bit value */ static __always_inline __u32 __swab32p(const __u32 *p) { #ifdef __arch_swab32p return __arch_swab32p(p); #else # 179 "./include/uapi/linux/swab.h" return __swab32(*p); #endif # 181 "./include/uapi/linux/swab.h" } /** * __swab64p - return a byteswapped 64-bit value from a pointer * @p: pointer to a naturally-aligned 64-bit value */ static __always_inline __u64 __swab64p(const __u64 *p) { #ifdef __arch_swab64p return __arch_swab64p(p); #else # 192 "./include/uapi/linux/swab.h" return __swab64(*p); #endif # 194 "./include/uapi/linux/swab.h" } /** * __swahw32p - return a wordswapped 32-bit value from a pointer * @p: pointer to a naturally-aligned 32-bit value * * See __swahw32() for details of wordswapping. */ static inline __u32 __swahw32p(const __u32 *p) { #ifdef __arch_swahw32p return __arch_swahw32p(p); #else # 207 "./include/uapi/linux/swab.h" return __swahw32(*p); #endif # 209 "./include/uapi/linux/swab.h" } /** * __swahb32p - return a high and low byteswapped 32-bit value from a pointer * @p: pointer to a naturally-aligned 32-bit value * * See __swahb32() for details of high/low byteswapping. */ static inline __u32 __swahb32p(const __u32 *p) { #ifdef __arch_swahb32p return __arch_swahb32p(p); #else # 222 "./include/uapi/linux/swab.h" return __swahb32(*p); #endif # 224 "./include/uapi/linux/swab.h" } /** * __swab16s - byteswap a 16-bit value in-place * @p: pointer to a naturally-aligned 16-bit value */ static inline void __swab16s(__u16 *p) { #ifdef __arch_swab16s __arch_swab16s(p); #else # 235 "./include/uapi/linux/swab.h" *p = __swab16p(p); #endif # 237 "./include/uapi/linux/swab.h" } /** * __swab32s - byteswap a 32-bit value in-place * @p: pointer to a naturally-aligned 32-bit value */ static __always_inline void __swab32s(__u32 *p) { #ifdef __arch_swab32s __arch_swab32s(p); #else # 247 "./include/uapi/linux/swab.h" *p = __swab32p(p); #endif # 249 "./include/uapi/linux/swab.h" } /** * __swab64s - byteswap a 64-bit value in-place * @p: pointer to a naturally-aligned 64-bit value */ static __always_inline void __swab64s(__u64 *p) { #ifdef __arch_swab64s __arch_swab64s(p); #else # 260 "./include/uapi/linux/swab.h" *p = __swab64p(p); #endif # 262 "./include/uapi/linux/swab.h" } /** * __swahw32s - wordswap a 32-bit value in-place * @p: pointer to a naturally-aligned 32-bit value * * See __swahw32() for details of wordswapping */ static inline void __swahw32s(__u32 *p) { #ifdef __arch_swahw32s __arch_swahw32s(p); #else # 275 "./include/uapi/linux/swab.h" *p = __swahw32p(p); #endif # 277 "./include/uapi/linux/swab.h" } /** * __swahb32s - high and low byteswap a 32-bit value in-place * @p: pointer to a naturally-aligned 32-bit value * * See __swahb32() for details of high and low byte swapping */ static inline void __swahb32s(__u32 *p) { #ifdef __arch_swahb32s __arch_swahb32s(p); #else # 290 "./include/uapi/linux/swab.h" *p = __swahb32p(p); #endif # 292 "./include/uapi/linux/swab.h" } #endif /* _UAPI_LINUX_SWAB_H */ # 296 "./include/uapi/linux/swab.h" # 6 "./include/linux/swab.h" 2 # define swab16 __swab16 # define swab32 __swab32 # define swab64 __swab64 # define swahw32 __swahw32 # define swahb32 __swahb32 # define swab16p __swab16p # define swab32p __swab32p # define swab64p __swab64p # define swahw32p __swahw32p # define swahb32p __swahb32p # define swab16s __swab16s # define swab32s __swab32s # define swab64s __swab64s # define swahw32s __swahw32s # define swahb32s __swahb32s #endif /* _LINUX_SWAB_H */ # 23 "./include/linux/swab.h" # 14 "./include/uapi/linux/byteorder/little_endian.h" 2 #define __constant_htonl(x) ((__force __be32)___constant_swab32((x))) #define __constant_ntohl(x) ___constant_swab32((__force __be32)(x)) #define __constant_htons(x) ((__force __be16)___constant_swab16((x))) #define __constant_ntohs(x) ___constant_swab16((__force __be16)(x)) #define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x)) #define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x)) #define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x)) #define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x)) #define __constant_cpu_to_le16(x) ((__force __le16)(__u16)(x)) #define __constant_le16_to_cpu(x) ((__force __u16)(__le16)(x)) #define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x))) #define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x)) #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x))) #define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x)) #define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x))) #define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be16)(x)) #define __cpu_to_le64(x) ((__force __le64)(__u64)(x)) #define __le64_to_cpu(x) ((__force __u64)(__le64)(x)) #define __cpu_to_le32(x) ((__force __le32)(__u32)(x)) #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) #define __cpu_to_le16(x) ((__force __le16)(__u16)(x)) #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) #define __cpu_to_be64(x) ((__force __be64)__swab64((x))) #define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x)) #define __cpu_to_be32(x) ((__force __be32)__swab32((x))) #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x)) #define __cpu_to_be16(x) ((__force __be16)__swab16((x))) #define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x)) static __always_inline __le64 __cpu_to_le64p(const __u64 *p) { return (__force __le64)*p; } static __always_inline __u64 __le64_to_cpup(const __le64 *p) { return (__force __u64)*p; } static __always_inline __le32 __cpu_to_le32p(const __u32 *p) { return (__force __le32)*p; } static __always_inline __u32 __le32_to_cpup(const __le32 *p) { return (__force __u32)*p; } static __always_inline __le16 __cpu_to_le16p(const __u16 *p) { return (__force __le16)*p; } static __always_inline __u16 __le16_to_cpup(const __le16 *p) { return (__force __u16)*p; } static __always_inline __be64 __cpu_to_be64p(const __u64 *p) { return (__force __be64)__swab64p(p); } static __always_inline __u64 __be64_to_cpup(const __be64 *p) { return __swab64p((__u64 *)p); } static __always_inline __be32 __cpu_to_be32p(const __u32 *p) { return (__force __be32)__swab32p(p); } static __always_inline __u32 __be32_to_cpup(const __be32 *p) { return __swab32p((__u32 *)p); } static __always_inline __be16 __cpu_to_be16p(const __u16 *p) { return (__force __be16)__swab16p(p); } static __always_inline __u16 __be16_to_cpup(const __be16 *p) { return __swab16p((__u16 *)p); } #define __cpu_to_le64s(x) do { (void)(x); } while (0) #define __le64_to_cpus(x) do { (void)(x); } while (0) #define __cpu_to_le32s(x) do { (void)(x); } while (0) #define __le32_to_cpus(x) do { (void)(x); } while (0) #define __cpu_to_le16s(x) do { (void)(x); } while (0) #define __le16_to_cpus(x) do { (void)(x); } while (0) #define __cpu_to_be64s(x) __swab64s((x)) #define __be64_to_cpus(x) __swab64s((x)) #define __cpu_to_be32s(x) __swab32s((x)) #define __be32_to_cpus(x) __swab32s((x)) #define __cpu_to_be16s(x) __swab16s((x)) #define __be16_to_cpus(x) __swab16s((x)) #endif /* _UAPI_LINUX_BYTEORDER_LITTLE_ENDIAN_H */ # 107 "./include/uapi/linux/byteorder/little_endian.h" # 6 "./include/linux/byteorder/little_endian.h" 2 #ifdef CONFIG_CPU_BIG_ENDIAN #warning inconsistent configuration, CONFIG_CPU_BIG_ENDIAN is set #endif # 10 "./include/linux/byteorder/little_endian.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 11 "./include/linux/byteorder/little_endian.h" # 1 "./include/linux/byteorder/generic.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_BYTEORDER_GENERIC_H #define _LINUX_BYTEORDER_GENERIC_H /* * linux/byteorder/generic.h * Generic Byte-reordering support * * The "... p" macros, like le64_to_cpup, can be used with pointers * to unaligned data, but there will be a performance penalty on * some architectures. Use get_unaligned for unaligned data. * * Francois-Rene Rideau 19970707 * gathered all the good ideas from all asm-foo/byteorder.h into one file, * cleaned them up. * I hope it is compliant with non-GCC compilers. * I decided to put __BYTEORDER_HAS_U64__ in byteorder.h, * because I wasn't sure it would be ok to put it in types.h * Upgraded it to 2.1.43 * Francois-Rene Rideau 19971012 * Upgraded it to 2.1.57 * to please Linus T., replaced huge #ifdef's between little/big endian * by nestedly #include'd files. * Francois-Rene Rideau 19971205 * Made it to 2.1.71; now a facelift: * Put files under include/linux/byteorder/ * Split swab from generic support. * * TODO: * = Regular kernel maintainers could also replace all these manual * byteswap macros that remain, disseminated among drivers, * after some grep or the sources... * = Linus might want to rename all these macros and files to fit his taste, * to fit his personal naming scheme. * = it seems that a few drivers would also appreciate * nybble swapping support... * = every architecture could add their byteswap macro in asm/byteorder.h * see how some architectures already do (i386, alpha, ppc, etc) * = cpu_to_beXX and beXX_to_cpu might some day need to be well * distinguished throughout the kernel. This is not the case currently, * since little endian, big endian, and pdp endian machines needn't it. * But this might be the case for, say, a port of Linux to 20/21 bit * architectures (and F21 Linux addict around?). */ /* * The following macros are to be defined by : * * Conversion of long and short int between network and host format * ntohl(__u32 x) * ntohs(__u16 x) * htonl(__u32 x) * htons(__u16 x) * It seems that some programs (which? where? or perhaps a standard? POSIX?) * might like the above to be functions, not macros (why?). * if that's true, then detect them, and take measures. * Anyway, the measure is: define only ___ntohl as a macro instead, * and in a separate file, have * unsigned long inline ntohl(x){return ___ntohl(x);} * * The same for constant arguments * __constant_ntohl(__u32 x) * __constant_ntohs(__u16 x) * __constant_htonl(__u32 x) * __constant_htons(__u16 x) * * Conversion of XX-bit integers (16- 32- or 64-) * between native CPU format and little/big endian format * 64-bit stuff only defined for proper architectures * cpu_to_[bl]eXX(__uXX x) * [bl]eXX_to_cpu(__uXX x) * * The same, but takes a pointer to the value to convert * cpu_to_[bl]eXXp(__uXX x) * [bl]eXX_to_cpup(__uXX x) * * The same, but change in situ * cpu_to_[bl]eXXs(__uXX x) * [bl]eXX_to_cpus(__uXX x) * * See asm-foo/byteorder.h for examples of how to provide * architecture-optimized versions * */ #define cpu_to_le64 __cpu_to_le64 #define le64_to_cpu __le64_to_cpu #define cpu_to_le32 __cpu_to_le32 #define le32_to_cpu __le32_to_cpu #define cpu_to_le16 __cpu_to_le16 #define le16_to_cpu __le16_to_cpu #define cpu_to_be64 __cpu_to_be64 #define be64_to_cpu __be64_to_cpu #define cpu_to_be32 __cpu_to_be32 #define be32_to_cpu __be32_to_cpu #define cpu_to_be16 __cpu_to_be16 #define be16_to_cpu __be16_to_cpu #define cpu_to_le64p __cpu_to_le64p #define le64_to_cpup __le64_to_cpup #define cpu_to_le32p __cpu_to_le32p #define le32_to_cpup __le32_to_cpup #define cpu_to_le16p __cpu_to_le16p #define le16_to_cpup __le16_to_cpup #define cpu_to_be64p __cpu_to_be64p #define be64_to_cpup __be64_to_cpup #define cpu_to_be32p __cpu_to_be32p #define be32_to_cpup __be32_to_cpup #define cpu_to_be16p __cpu_to_be16p #define be16_to_cpup __be16_to_cpup #define cpu_to_le64s __cpu_to_le64s #define le64_to_cpus __le64_to_cpus #define cpu_to_le32s __cpu_to_le32s #define le32_to_cpus __le32_to_cpus #define cpu_to_le16s __cpu_to_le16s #define le16_to_cpus __le16_to_cpus #define cpu_to_be64s __cpu_to_be64s #define be64_to_cpus __be64_to_cpus #define cpu_to_be32s __cpu_to_be32s #define be32_to_cpus __be32_to_cpus #define cpu_to_be16s __cpu_to_be16s #define be16_to_cpus __be16_to_cpus /* * They have to be macros in order to do the constant folding * correctly - if the argument passed into a inline function * it is no longer constant according to gcc.. */ #undef ntohl #undef ntohs #undef htonl #undef htons #define ___htonl(x) __cpu_to_be32(x) #define ___htons(x) __cpu_to_be16(x) #define ___ntohl(x) __be32_to_cpu(x) #define ___ntohs(x) __be16_to_cpu(x) #define htonl(x) ___htonl(x) #define ntohl(x) ___ntohl(x) #define htons(x) ___htons(x) #define ntohs(x) ___ntohs(x) static inline void le16_add_cpu(__le16 *var, u16 val) { *var = cpu_to_le16(le16_to_cpu(*var) + val); } static inline void le32_add_cpu(__le32 *var, u32 val) { *var = cpu_to_le32(le32_to_cpu(*var) + val); } static inline void le64_add_cpu(__le64 *var, u64 val) { *var = cpu_to_le64(le64_to_cpu(*var) + val); } static inline void be16_add_cpu(__be16 *var, u16 val) { *var = cpu_to_be16(be16_to_cpu(*var) + val); } static inline void be32_add_cpu(__be32 *var, u32 val) { *var = cpu_to_be32(be32_to_cpu(*var) + val); } static inline void be64_add_cpu(__be64 *var, u64 val) { *var = cpu_to_be64(be64_to_cpu(*var) + val); } static inline void cpu_to_be32_array(__be32 *dst, const u32 *src, size_t len) { int i; for (i = 0; i < len; i++) dst[i] = cpu_to_be32(src[i]); } static inline void be32_to_cpu_array(u32 *dst, const __be32 *src, size_t len) { int i; for (i = 0; i < len; i++) dst[i] = be32_to_cpu(src[i]); } #endif /* _LINUX_BYTEORDER_GENERIC_H */ # 191 "./include/linux/byteorder/generic.h" # 12 "./include/linux/byteorder/little_endian.h" 2 #endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */ # 13 "./include/linux/byteorder/little_endian.h" # 6 "./arch/x86/include/uapi/asm/byteorder.h" 2 #endif /* _ASM_X86_BYTEORDER_H */ # 8 "./arch/x86/include/uapi/asm/byteorder.h" # 7 "./include/asm-generic/bitops/le.h" 2 #if defined(__LITTLE_ENDIAN) #define BITOP_LE_SWIZZLE 0 static inline unsigned long find_next_zero_bit_le(const void *addr, unsigned long size, unsigned long offset) { return find_next_zero_bit(addr, size, offset); } static inline unsigned long find_next_bit_le(const void *addr, unsigned long size, unsigned long offset) { return find_next_bit(addr, size, offset); } static inline unsigned long find_first_zero_bit_le(const void *addr, unsigned long size) { return find_first_zero_bit(addr, size); } #elif defined(__BIG_ENDIAN) # 31 "./include/asm-generic/bitops/le.h" #define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7) #ifndef find_next_zero_bit_le extern unsigned long find_next_zero_bit_le(const void *addr, unsigned long size, unsigned long offset); #endif # 38 "./include/asm-generic/bitops/le.h" #ifndef find_next_bit_le extern unsigned long find_next_bit_le(const void *addr, unsigned long size, unsigned long offset); #endif # 43 "./include/asm-generic/bitops/le.h" #ifndef find_first_zero_bit_le #define find_first_zero_bit_le(addr, size) \ find_next_zero_bit_le((addr), (size), 0) #endif # 48 "./include/asm-generic/bitops/le.h" #else # 50 "./include/asm-generic/bitops/le.h" #error "Please fix " #endif # 52 "./include/asm-generic/bitops/le.h" static inline int test_bit_le(int nr, const void *addr) { return test_bit(nr ^ BITOP_LE_SWIZZLE, addr); } static inline void set_bit_le(int nr, void *addr) { set_bit(nr ^ BITOP_LE_SWIZZLE, addr); } static inline void clear_bit_le(int nr, void *addr) { clear_bit(nr ^ BITOP_LE_SWIZZLE, addr); } static inline void __set_bit_le(int nr, void *addr) { __set_bit(nr ^ BITOP_LE_SWIZZLE, addr); } static inline void __clear_bit_le(int nr, void *addr) { __clear_bit(nr ^ BITOP_LE_SWIZZLE, addr); } static inline int test_and_set_bit_le(int nr, void *addr) { return test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr); } static inline int test_and_clear_bit_le(int nr, void *addr) { return test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr); } static inline int __test_and_set_bit_le(int nr, void *addr) { return __test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr); } static inline int __test_and_clear_bit_le(int nr, void *addr) { return __test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr); } #endif /* _ASM_GENERIC_BITOPS_LE_H_ */ # 99 "./include/asm-generic/bitops/le.h" # 519 "./arch/x86/include/asm/bitops.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 520 "./arch/x86/include/asm/bitops.h" # 1 "./include/asm-generic/bitops/ext2-atomic-setbit.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_SETBIT_H_ #define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_SETBIT_H_ /* * Atomic bitops based version of ext2 atomic bitops */ #define ext2_set_bit_atomic(l, nr, addr) test_and_set_bit_le(nr, addr) #define ext2_clear_bit_atomic(l, nr, addr) test_and_clear_bit_le(nr, addr) #endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_SETBIT_H_ */ # 13 "./include/asm-generic/bitops/ext2-atomic-setbit.h" # 521 "./arch/x86/include/asm/bitops.h" 2 #endif /* __KERNEL__ */ # 523 "./arch/x86/include/asm/bitops.h" #endif /* _ASM_X86_BITOPS_H */ # 524 "./arch/x86/include/asm/bitops.h" # 39 "./include/linux/bitops.h" 2 #define for_each_set_bit(bit, addr, size) \ for ((bit) = find_first_bit((addr), (size)); \ (bit) < (size); \ (bit) = find_next_bit((addr), (size), (bit) + 1)) /* same as for_each_set_bit() but use bit as value to start with */ #define for_each_set_bit_from(bit, addr, size) \ for ((bit) = find_next_bit((addr), (size), (bit)); \ (bit) < (size); \ (bit) = find_next_bit((addr), (size), (bit) + 1)) #define for_each_clear_bit(bit, addr, size) \ for ((bit) = find_first_zero_bit((addr), (size)); \ (bit) < (size); \ (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) /* same as for_each_clear_bit() but use bit as value to start with */ #define for_each_clear_bit_from(bit, addr, size) \ for ((bit) = find_next_zero_bit((addr), (size), (bit)); \ (bit) < (size); \ (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) static inline int get_bitmask_order(unsigned int count) { int order; order = fls(count); return order; /* We could be slightly more clever with -1 here... */ } static __always_inline unsigned long hweight_long(unsigned long w) { return sizeof(w) == 4 ? hweight32(w) : hweight64(w); } /** * rol64 - rotate a 64-bit value left * @word: value to rotate * @shift: bits to roll */ static inline __u64 rol64(__u64 word, unsigned int shift) { return (word << shift) | (word >> (64 - shift)); } /** * ror64 - rotate a 64-bit value right * @word: value to rotate * @shift: bits to roll */ static inline __u64 ror64(__u64 word, unsigned int shift) { return (word >> shift) | (word << (64 - shift)); } /** * rol32 - rotate a 32-bit value left * @word: value to rotate * @shift: bits to roll */ static inline __u32 rol32(__u32 word, unsigned int shift) { return (word << shift) | (word >> ((-shift) & 31)); } /** * ror32 - rotate a 32-bit value right * @word: value to rotate * @shift: bits to roll */ static inline __u32 ror32(__u32 word, unsigned int shift) { return (word >> shift) | (word << (32 - shift)); } /** * rol16 - rotate a 16-bit value left * @word: value to rotate * @shift: bits to roll */ static inline __u16 rol16(__u16 word, unsigned int shift) { return (word << shift) | (word >> (16 - shift)); } /** * ror16 - rotate a 16-bit value right * @word: value to rotate * @shift: bits to roll */ static inline __u16 ror16(__u16 word, unsigned int shift) { return (word >> shift) | (word << (16 - shift)); } /** * rol8 - rotate an 8-bit value left * @word: value to rotate * @shift: bits to roll */ static inline __u8 rol8(__u8 word, unsigned int shift) { return (word << shift) | (word >> (8 - shift)); } /** * ror8 - rotate an 8-bit value right * @word: value to rotate * @shift: bits to roll */ static inline __u8 ror8(__u8 word, unsigned int shift) { return (word >> shift) | (word << (8 - shift)); } /** * sign_extend32 - sign extend a 32-bit value using specified bit as sign-bit * @value: value to sign extend * @index: 0 based bit index (0<=index<32) to sign bit * * This is safe to use for 16- and 8-bit types as well. */ static inline __s32 sign_extend32(__u32 value, int index) { __u8 shift = 31 - index; return (__s32)(value << shift) >> shift; } /** * sign_extend64 - sign extend a 64-bit value using specified bit as sign-bit * @value: value to sign extend * @index: 0 based bit index (0<=index<64) to sign bit */ static inline __s64 sign_extend64(__u64 value, int index) { __u8 shift = 63 - index; return (__s64)(value << shift) >> shift; } static inline unsigned fls_long(unsigned long l) { if (sizeof(l) == 4) return fls(l); return fls64(l); } static inline int get_count_order(unsigned int count) { int order; order = fls(count) - 1; if (count & (count - 1)) order++; return order; } /** * get_count_order_long - get order after rounding @l up to power of 2 * @l: parameter * * it is same as get_count_order() but with long type parameter */ static inline int get_count_order_long(unsigned long l) { if (l == 0UL) return -1; else if (l & (l - 1UL)) return (int)fls_long(l); else return (int)fls_long(l) - 1; } /** * __ffs64 - find first set bit in a 64 bit word * @word: The 64 bit word * * On 64 bit arches this is a synomyn for __ffs * The result is not defined if no bits are set, so check that @word * is non-zero before calling this. */ static inline unsigned long __ffs64(u64 word) { #if BITS_PER_LONG == 32 if (((u32)word) == 0UL) return __ffs((u32)(word >> 32)) + 32; #elif BITS_PER_LONG != 64 # 226 "./include/linux/bitops.h" #error BITS_PER_LONG not 32 or 64 #endif # 228 "./include/linux/bitops.h" return __ffs((unsigned long)word); } /** * assign_bit - Assign value to a bit in memory * @nr: the bit to set * @addr: the address to start counting from * @value: the value to assign */ static __always_inline void assign_bit(long nr, volatile unsigned long *addr, bool value) { if (value) set_bit(nr, addr); else clear_bit(nr, addr); } static __always_inline void __assign_bit(long nr, volatile unsigned long *addr, bool value) { if (value) __set_bit(nr, addr); else __clear_bit(nr, addr); } #ifdef __KERNEL__ #ifndef set_mask_bits #define set_mask_bits(ptr, _mask, _bits) \ ({ \ const typeof(*ptr) mask = (_mask), bits = (_bits); \ typeof(*ptr) old, new; \ \ do { \ old = READ_ONCE(*ptr); \ new = (old & ~mask) | bits; \ } while (cmpxchg(ptr, old, new) != old); \ \ new; \ }) #endif # 271 "./include/linux/bitops.h" #ifndef bit_clear_unless #define bit_clear_unless(ptr, _clear, _test) \ ({ \ const typeof(*ptr) clear = (_clear), test = (_test); \ typeof(*ptr) old, new; \ \ do { \ old = READ_ONCE(*ptr); \ new = old & ~clear; \ } while (!(old & test) && \ cmpxchg(ptr, old, new) != old); \ \ !(old & test); \ }) #endif # 287 "./include/linux/bitops.h" #ifndef find_last_bit /** * find_last_bit - find the last set bit in a memory region * @addr: The address to start the search at * @size: The number of bits to search * * Returns the bit number of the last set bit, or size. */ extern unsigned long find_last_bit(const unsigned long *addr, unsigned long size); #endif # 299 "./include/linux/bitops.h" #endif /* __KERNEL__ */ # 301 "./include/linux/bitops.h" #endif # 302 "./include/linux/bitops.h" # 12 "./include/linux/kernel.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 12 "./include/linux/kernel.h" # 1 "./include/linux/log2.h" 1 /* Integer base 2 logarithm calculation * * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _LINUX_LOG2_H #define _LINUX_LOG2_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 15 "./include/linux/log2.h" # 16 "./include/linux/log2.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 16 "./include/linux/log2.h" # 17 "./include/linux/log2.h" /* * non-constant log of base 2 calculators * - the arch may override these in asm/bitops.h if they can be implemented * more efficiently than using fls() and fls64() * - the arch is not required to handle n==0 if implementing the fallback */ #ifndef CONFIG_ARCH_HAS_ILOG2_U32 static inline __attribute__((const)) int __ilog2_u32(u32 n) { return fls(n) - 1; } #endif # 31 "./include/linux/log2.h" #ifndef CONFIG_ARCH_HAS_ILOG2_U64 static inline __attribute__((const)) int __ilog2_u64(u64 n) { return fls64(n) - 1; } #endif # 39 "./include/linux/log2.h" /** * is_power_of_2() - check if a value is a power of two * @n: the value to check * * Determine whether some value is a power of two, where zero is * *not* considered a power of two. * Return: true if @n is a power of 2, otherwise false. */ static inline __attribute__((const)) bool is_power_of_2(unsigned long n) { return (n != 0 && ((n & (n - 1)) == 0)); } /** * __roundup_pow_of_two() - round up to nearest power of two * @n: value to round up */ static inline __attribute__((const)) unsigned long __roundup_pow_of_two(unsigned long n) { return 1UL << fls_long(n - 1); } /** * __rounddown_pow_of_two() - round down to nearest power of two * @n: value to round down */ static inline __attribute__((const)) unsigned long __rounddown_pow_of_two(unsigned long n) { return 1UL << (fls_long(n) - 1); } /** * ilog2 - log base 2 of 32-bit or a 64-bit unsigned value * @n: parameter * * constant-capable log of base 2 calculation * - this can be used to initialise global variables from constant data, hence * the massive ternary operator construction * * selects the appropriately-sized optimised version depending on sizeof(n) */ #define ilog2(n) \ ( \ __builtin_constant_p(n) ? ( \ (n) < 2 ? 0 : \ (n) & (1ULL << 63) ? 63 : \ (n) & (1ULL << 62) ? 62 : \ (n) & (1ULL << 61) ? 61 : \ (n) & (1ULL << 60) ? 60 : \ (n) & (1ULL << 59) ? 59 : \ (n) & (1ULL << 58) ? 58 : \ (n) & (1ULL << 57) ? 57 : \ (n) & (1ULL << 56) ? 56 : \ (n) & (1ULL << 55) ? 55 : \ (n) & (1ULL << 54) ? 54 : \ (n) & (1ULL << 53) ? 53 : \ (n) & (1ULL << 52) ? 52 : \ (n) & (1ULL << 51) ? 51 : \ (n) & (1ULL << 50) ? 50 : \ (n) & (1ULL << 49) ? 49 : \ (n) & (1ULL << 48) ? 48 : \ (n) & (1ULL << 47) ? 47 : \ (n) & (1ULL << 46) ? 46 : \ (n) & (1ULL << 45) ? 45 : \ (n) & (1ULL << 44) ? 44 : \ (n) & (1ULL << 43) ? 43 : \ (n) & (1ULL << 42) ? 42 : \ (n) & (1ULL << 41) ? 41 : \ (n) & (1ULL << 40) ? 40 : \ (n) & (1ULL << 39) ? 39 : \ (n) & (1ULL << 38) ? 38 : \ (n) & (1ULL << 37) ? 37 : \ (n) & (1ULL << 36) ? 36 : \ (n) & (1ULL << 35) ? 35 : \ (n) & (1ULL << 34) ? 34 : \ (n) & (1ULL << 33) ? 33 : \ (n) & (1ULL << 32) ? 32 : \ (n) & (1ULL << 31) ? 31 : \ (n) & (1ULL << 30) ? 30 : \ (n) & (1ULL << 29) ? 29 : \ (n) & (1ULL << 28) ? 28 : \ (n) & (1ULL << 27) ? 27 : \ (n) & (1ULL << 26) ? 26 : \ (n) & (1ULL << 25) ? 25 : \ (n) & (1ULL << 24) ? 24 : \ (n) & (1ULL << 23) ? 23 : \ (n) & (1ULL << 22) ? 22 : \ (n) & (1ULL << 21) ? 21 : \ (n) & (1ULL << 20) ? 20 : \ (n) & (1ULL << 19) ? 19 : \ (n) & (1ULL << 18) ? 18 : \ (n) & (1ULL << 17) ? 17 : \ (n) & (1ULL << 16) ? 16 : \ (n) & (1ULL << 15) ? 15 : \ (n) & (1ULL << 14) ? 14 : \ (n) & (1ULL << 13) ? 13 : \ (n) & (1ULL << 12) ? 12 : \ (n) & (1ULL << 11) ? 11 : \ (n) & (1ULL << 10) ? 10 : \ (n) & (1ULL << 9) ? 9 : \ (n) & (1ULL << 8) ? 8 : \ (n) & (1ULL << 7) ? 7 : \ (n) & (1ULL << 6) ? 6 : \ (n) & (1ULL << 5) ? 5 : \ (n) & (1ULL << 4) ? 4 : \ (n) & (1ULL << 3) ? 3 : \ (n) & (1ULL << 2) ? 2 : \ 1 ) : \ (sizeof(n) <= 4) ? \ __ilog2_u32(n) : \ __ilog2_u64(n) \ ) /** * roundup_pow_of_two - round the given value up to nearest power of two * @n: parameter * * round the given value up to the nearest power of two * - the result is undefined when n == 0 * - this can be used to initialise global variables from constant data */ #define roundup_pow_of_two(n) \ ( \ __builtin_constant_p(n) ? ( \ (n == 1) ? 1 : \ (1UL << (ilog2((n) - 1) + 1)) \ ) : \ __roundup_pow_of_two(n) \ ) /** * rounddown_pow_of_two - round the given value down to nearest power of two * @n: parameter * * round the given value down to the nearest power of two * - the result is undefined when n == 0 * - this can be used to initialise global variables from constant data */ #define rounddown_pow_of_two(n) \ ( \ __builtin_constant_p(n) ? ( \ (1UL << ilog2(n))) : \ __rounddown_pow_of_two(n) \ ) static inline __attribute_const__ int __order_base_2(unsigned long n) { return n > 1 ? ilog2(n - 1) + 1 : 0; } /** * order_base_2 - calculate the (rounded up) base 2 order of the argument * @n: parameter * * The first few values calculated by this routine: * ob2(0) = 0 * ob2(1) = 0 * ob2(2) = 1 * ob2(3) = 2 * ob2(4) = 2 * ob2(5) = 3 * ... and so on. */ #define order_base_2(n) \ ( \ __builtin_constant_p(n) ? ( \ ((n) == 0 || (n) == 1) ? 0 : \ ilog2((n) - 1) + 1) : \ __order_base_2(n) \ ) #endif /* _LINUX_LOG2_H */ # 215 "./include/linux/log2.h" # 13 "./include/linux/kernel.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 13 "./include/linux/kernel.h" # 1 "./include/linux/typecheck.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef TYPECHECK_H_INCLUDED #define TYPECHECK_H_INCLUDED /* * Check at compile time that something is of a particular type. * Always evaluates to 1 so you may use it easily in comparisons. */ #define typecheck(type,x) \ ({ type __dummy; \ typeof(x) __dummy2; \ (void)(&__dummy == &__dummy2); \ 1; \ }) /* * Check at compile time that 'function' is a certain type, or is a pointer * to that type (needs to use typedef for the function type.) */ #define typecheck_fn(type,function) \ ({ typeof(type) __tmp = function; \ (void)__tmp; \ }) #endif /* TYPECHECK_H_INCLUDED */ # 26 "./include/linux/typecheck.h" # 14 "./include/linux/kernel.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 14 "./include/linux/kernel.h" # 1 "./include/linux/printk.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __KERNEL_PRINTK__ #define __KERNEL_PRINTK__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/linux/printk.h" # 6 "./include/linux/printk.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./include/linux/printk.h" # 1 "./include/linux/init.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_INIT_H #define _LINUX_INIT_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/linux/init.h" # 6 "./include/linux/init.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./include/linux/init.h" # 7 "./include/linux/init.h" /* Built-in __init functions needn't be compiled with retpoline */ #if defined(__noretpoline) && !defined(MODULE) #define __noinitretpoline __noretpoline #else # 12 "./include/linux/init.h" #define __noinitretpoline #endif # 14 "./include/linux/init.h" /* These macros are used to mark some functions or * initialized data (doesn't apply to uninitialized data) * as `initialization' functions. The kernel can take this * as hint that the function is used only during the initialization * phase and free up used memory resources after * * Usage: * For functions: * * You should add __init immediately before the function name, like: * * static void __init initme(int x, int y) * { * extern int z; z = x * y; * } * * If the function has a prototype somewhere, you can also add * __init between closing brace of the prototype and semicolon: * * extern int initialize_foobar_device(int, int, int) __init; * * For initialized data: * You should insert __initdata or __initconst between the variable name * and equal sign followed by value, e.g.: * * static int init_variable __initdata = 0; * static const char linux_logo[] __initconst = { 0x32, 0x36, ... }; * * Don't forget to initialize data not at file scope, i.e. within a function, * as gcc otherwise puts the data into the bss section and not into the init * section. */ /* These are for everybody (although not all archs will actually discard it in modules) */ #define __init __section(.init.text) __cold __latent_entropy __noinitretpoline #define __initdata __section(.init.data) #define __initconst __section(.init.rodata) #define __exitdata __section(.exit.data) #define __exit_call __used __section(.exitcall.exit) /* * modpost check for section mismatches during the kernel build. * A section mismatch happens when there are references from a * code or data section to an init section (both code or data). * The init sections are (for most archs) discarded by the kernel * when early init has completed so all such references are potential bugs. * For exit sections the same issue exists. * * The following markers are used for the cases where the reference to * the *init / *exit section (code or data) is valid and will teach * modpost not to issue a warning. Intended semantics is that a code or * data tagged __ref* can reference code or data from init section without * producing a warning (of course, no warning does not mean code is * correct, so optimally document why the __ref is needed and why it's OK). * * The markers follow same syntax rules as __init / __initdata. */ #define __ref __section(.ref.text) noinline #define __refdata __section(.ref.data) #define __refconst __section(.ref.rodata) #ifdef MODULE #define __exitused #else # 80 "./include/linux/init.h" #define __exitused __used #endif # 82 "./include/linux/init.h" #define __exit __section(.exit.text) __exitused __cold notrace /* Used for MEMORY_HOTPLUG */ #define __meminit __section(.meminit.text) __cold notrace \ __latent_entropy #define __meminitdata __section(.meminit.data) #define __meminitconst __section(.meminit.rodata) #define __memexit __section(.memexit.text) __exitused __cold notrace #define __memexitdata __section(.memexit.data) #define __memexitconst __section(.memexit.rodata) /* For assembly routines */ #define __HEAD .section ".head.text","ax" #define __INIT .section ".init.text","ax" #define __FINIT .previous #define __INITDATA .section ".init.data","aw",%progbits #define __INITRODATA .section ".init.rodata","a",%progbits #define __FINITDATA .previous #define __MEMINIT .section ".meminit.text", "ax" #define __MEMINITDATA .section ".meminit.data", "aw" #define __MEMINITRODATA .section ".meminit.rodata", "a" /* silence warnings when references are OK */ #define __REF .section ".ref.text", "ax" #define __REFDATA .section ".ref.data", "aw" #define __REFCONST .section ".ref.rodata", "a" #ifndef __ASSEMBLY__ /* * Used for initialization calls.. */ typedef int (*initcall_t)(void); typedef void (*exitcall_t)(void); extern initcall_t __con_initcall_start[], __con_initcall_end[]; extern initcall_t __security_initcall_start[], __security_initcall_end[]; /* Used for contructor calls. */ typedef void (*ctor_fn_t)(void); /* Defined in init/main.c */ extern int do_one_initcall(initcall_t fn); extern char __initdata boot_command_line[]; extern char *saved_command_line; extern unsigned int reset_devices; /* used by init/main.c */ void setup_arch(char **); void prepare_namespace(void); void __init load_default_modules(void); int __init init_rootfs(void); #if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX) extern bool rodata_enabled; #endif # 140 "./include/linux/init.h" #ifdef CONFIG_STRICT_KERNEL_RWX void mark_rodata_ro(void); #endif # 143 "./include/linux/init.h" extern void (*late_time_init)(void); extern bool initcall_debug; #endif # 149 "./include/linux/init.h" #ifndef MODULE #ifndef __ASSEMBLY__ /* * initcalls are now grouped by functionality into separate * subsections. Ordering inside the subsections is determined * by link order. * For backwards compatibility, initcall() puts the call in * the device init subsection. * * The `id' arg to __define_initcall() is needed so that multiple initcalls * can point at the same handler without causing duplicate-symbol build errors. * * Initcalls are run by placing pointers in initcall sections that the * kernel iterates at runtime. The linker can do dead code / data elimination * and remove that completely, so the initcall sections have to be marked * as KEEP() in the linker script. */ #define __define_initcall(fn, id) \ static initcall_t __initcall_##fn##id __used \ __attribute__((__section__(".initcall" #id ".init"))) = fn; /* * Early initcalls run before initializing SMP. * * Only for built-in code, not modules. */ #define early_initcall(fn) __define_initcall(fn, early) /* * A "pure" initcall has no dependencies on anything else, and purely * initializes variables that couldn't be statically initialized. * * This only exists for built-in code, not for modules. * Keep main.c:initcall_level_names[] in sync. */ #define pure_initcall(fn) __define_initcall(fn, 0) #define core_initcall(fn) __define_initcall(fn, 1) #define core_initcall_sync(fn) __define_initcall(fn, 1s) #define postcore_initcall(fn) __define_initcall(fn, 2) #define postcore_initcall_sync(fn) __define_initcall(fn, 2s) #define arch_initcall(fn) __define_initcall(fn, 3) #define arch_initcall_sync(fn) __define_initcall(fn, 3s) #define subsys_initcall(fn) __define_initcall(fn, 4) #define subsys_initcall_sync(fn) __define_initcall(fn, 4s) #define fs_initcall(fn) __define_initcall(fn, 5) #define fs_initcall_sync(fn) __define_initcall(fn, 5s) #define rootfs_initcall(fn) __define_initcall(fn, rootfs) #define device_initcall(fn) __define_initcall(fn, 6) #define device_initcall_sync(fn) __define_initcall(fn, 6s) #define late_initcall(fn) __define_initcall(fn, 7) #define late_initcall_sync(fn) __define_initcall(fn, 7s) #define __initcall(fn) device_initcall(fn) #define __exitcall(fn) \ static exitcall_t __exitcall_##fn __exit_call = fn #define console_initcall(fn) \ static initcall_t __initcall_##fn \ __used __section(.con_initcall.init) = fn #define security_initcall(fn) \ static initcall_t __initcall_##fn \ __used __section(.security_initcall.init) = fn struct obs_kernel_param { const char *str; int (*setup_func)(char *); int early; }; /* * Only for really core code. See moduleparam.h for the normal way. * * Force the alignment so the compiler doesn't space elements of the * obs_kernel_param "array" too far apart in .init.setup. */ #define __setup_param(str, unique_id, fn, early) \ static const char __setup_str_##unique_id[] __initconst \ __aligned(1) = str; \ static struct obs_kernel_param __setup_##unique_id \ __used __section(.init.setup) \ __attribute__((aligned((sizeof(long))))) \ = { __setup_str_##unique_id, fn, early } #define __setup(str, fn) \ __setup_param(str, fn, fn, 0) /* * NOTE: fn is as per module_param, not __setup! * Emits warning if fn returns non-zero. */ #define early_param(str, fn) \ __setup_param(str, fn, fn, 1) #define early_param_on_off(str_on, str_off, var, config) \ \ int var = IS_ENABLED(config); \ \ static int __init parse_##var##_on(char *arg) \ { \ var = 1; \ return 0; \ } \ __setup_param(str_on, parse_##var##_on, parse_##var##_on, 1); \ \ static int __init parse_##var##_off(char *arg) \ { \ var = 0; \ return 0; \ } \ __setup_param(str_off, parse_##var##_off, parse_##var##_off, 1) /* Relies on boot_command_line being set */ void __init parse_early_param(void); void __init parse_early_options(char *cmdline); #endif /* __ASSEMBLY__ */ # 271 "./include/linux/init.h" #else /* MODULE */ # 273 "./include/linux/init.h" #define __setup_param(str, unique_id, fn) /* nothing */ #define __setup(str, func) /* nothing */ #endif # 277 "./include/linux/init.h" /* Data marked not to be saved by software suspend */ #define __nosavedata __section(.data..nosave) #ifdef MODULE #define __exit_p(x) x #else # 284 "./include/linux/init.h" #define __exit_p(x) NULL #endif # 286 "./include/linux/init.h" #endif /* _LINUX_INIT_H */ # 288 "./include/linux/init.h" # 7 "./include/linux/printk.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 7 "./include/linux/printk.h" # 1 "./include/linux/kern_levels.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __KERN_LEVELS_H__ #define __KERN_LEVELS_H__ #define KERN_SOH "\001" /* ASCII Start Of Header */ #define KERN_SOH_ASCII '\001' #define KERN_EMERG KERN_SOH "0" /* system is unusable */ #define KERN_ALERT KERN_SOH "1" /* action must be taken immediately */ #define KERN_CRIT KERN_SOH "2" /* critical conditions */ #define KERN_ERR KERN_SOH "3" /* error conditions */ #define KERN_WARNING KERN_SOH "4" /* warning conditions */ #define KERN_NOTICE KERN_SOH "5" /* normal but significant condition */ #define KERN_INFO KERN_SOH "6" /* informational */ #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */ #define KERN_DEFAULT KERN_SOH "d" /* the default kernel loglevel */ /* * Annotation for a "continued" line of log printout (only done after a * line that had no enclosing \n). Only to be used by core/arch code * during early bootup (a continued line is not SMP-safe otherwise). */ #define KERN_CONT KERN_SOH "c" /* integer equivalents of KERN_ */ #define LOGLEVEL_SCHED -2 /* Deferred messages from sched code * are set to this special level */ #define LOGLEVEL_DEFAULT -1 /* default (or last) loglevel */ #define LOGLEVEL_EMERG 0 /* system is unusable */ #define LOGLEVEL_ALERT 1 /* action must be taken immediately */ #define LOGLEVEL_CRIT 2 /* critical conditions */ #define LOGLEVEL_ERR 3 /* error conditions */ #define LOGLEVEL_WARNING 4 /* warning conditions */ #define LOGLEVEL_NOTICE 5 /* normal but significant condition */ #define LOGLEVEL_INFO 6 /* informational */ #define LOGLEVEL_DEBUG 7 /* debug-level messages */ #endif # 40 "./include/linux/kern_levels.h" # 8 "./include/linux/printk.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 8 "./include/linux/printk.h" # 9 "./include/linux/printk.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 9 "./include/linux/printk.h" # 1 "./include/linux/cache.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __LINUX_CACHE_H #define __LINUX_CACHE_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/linux/cache.h" # 1 "./include/uapi/linux/kernel.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UAPI_LINUX_KERNEL_H #define _UAPI_LINUX_KERNEL_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/uapi/linux/kernel.h" # 1 "./include/uapi/linux/sysinfo.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_SYSINFO_H #define _LINUX_SYSINFO_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/uapi/linux/sysinfo.h" # 6 "./include/uapi/linux/sysinfo.h" #define SI_LOAD_SHIFT 16 struct sysinfo { __kernel_long_t uptime; /* Seconds since boot */ __kernel_ulong_t loads[3]; /* 1, 5, and 15 minute load averages */ __kernel_ulong_t totalram; /* Total usable main memory size */ __kernel_ulong_t freeram; /* Available memory size */ __kernel_ulong_t sharedram; /* Amount of shared memory */ __kernel_ulong_t bufferram; /* Memory used by buffers */ __kernel_ulong_t totalswap; /* Total swap space size */ __kernel_ulong_t freeswap; /* swap space still available */ __u16 procs; /* Number of current processes */ __u16 pad; /* Explicit padding for m68k */ __kernel_ulong_t totalhigh; /* Total high memory size */ __kernel_ulong_t freehigh; /* Available high memory size */ __u32 mem_unit; /* Memory unit size in bytes */ char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)]; /* Padding: libc5 uses this.. */ }; #endif /* _LINUX_SYSINFO_H */ # 26 "./include/uapi/linux/sysinfo.h" # 6 "./include/uapi/linux/kernel.h" 2 /* * 'kernel.h' contains some often-used function prototypes etc */ #define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) #endif /* _UAPI_LINUX_KERNEL_H */ # 16 "./include/uapi/linux/kernel.h" # 6 "./include/linux/cache.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./include/linux/cache.h" # 1 "./arch/x86/include/asm/cache.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_CACHE_H #define _ASM_X86_CACHE_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./arch/x86/include/asm/cache.h" # 6 "./arch/x86/include/asm/cache.h" /* L1 cache line size */ #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT) #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) #define __read_mostly __attribute__((__section__(".data..read_mostly"))) #define INTERNODE_CACHE_SHIFT CONFIG_X86_INTERNODE_CACHE_SHIFT #define INTERNODE_CACHE_BYTES (1 << INTERNODE_CACHE_SHIFT) #ifdef CONFIG_X86_VSMP #ifdef CONFIG_SMP #define __cacheline_aligned_in_smp \ __attribute__((__aligned__(INTERNODE_CACHE_BYTES))) \ __page_aligned_data #endif # 22 "./arch/x86/include/asm/cache.h" #endif # 23 "./arch/x86/include/asm/cache.h" #endif /* _ASM_X86_CACHE_H */ # 25 "./arch/x86/include/asm/cache.h" # 7 "./include/linux/cache.h" 2 #ifndef L1_CACHE_ALIGN #define L1_CACHE_ALIGN(x) __ALIGN_KERNEL(x, L1_CACHE_BYTES) #endif # 11 "./include/linux/cache.h" #ifndef SMP_CACHE_BYTES #define SMP_CACHE_BYTES L1_CACHE_BYTES #endif # 15 "./include/linux/cache.h" /* * __read_mostly is used to keep rarely changing variables out of frequently * updated cachelines. If an architecture doesn't support it, ignore the * hint. */ #ifndef __read_mostly #define __read_mostly #endif # 24 "./include/linux/cache.h" /* * __ro_after_init is used to mark things that are read-only after init (i.e. * after mark_rodata_ro() has been called). These are effectively read-only, * but may get written to during init, so can't live in .rodata (via "const"). */ #ifndef __ro_after_init #define __ro_after_init __attribute__((__section__(".data..ro_after_init"))) #endif # 33 "./include/linux/cache.h" #ifndef ____cacheline_aligned #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))) #endif # 37 "./include/linux/cache.h" #ifndef ____cacheline_aligned_in_smp #ifdef CONFIG_SMP #define ____cacheline_aligned_in_smp ____cacheline_aligned #else # 42 "./include/linux/cache.h" #define ____cacheline_aligned_in_smp #endif /* CONFIG_SMP */ # 44 "./include/linux/cache.h" #endif # 45 "./include/linux/cache.h" #ifndef __cacheline_aligned #define __cacheline_aligned \ __attribute__((__aligned__(SMP_CACHE_BYTES), \ __section__(".data..cacheline_aligned"))) #endif /* __cacheline_aligned */ # 51 "./include/linux/cache.h" #ifndef __cacheline_aligned_in_smp #ifdef CONFIG_SMP #define __cacheline_aligned_in_smp __cacheline_aligned #else # 56 "./include/linux/cache.h" #define __cacheline_aligned_in_smp #endif /* CONFIG_SMP */ # 58 "./include/linux/cache.h" #endif # 59 "./include/linux/cache.h" /* * The maximum alignment needed for some critical structures * These could be inter-node cacheline sizes/L3 cacheline * size etc. Define this in asm/cache.h for your arch */ #ifndef INTERNODE_CACHE_SHIFT #define INTERNODE_CACHE_SHIFT L1_CACHE_SHIFT #endif # 68 "./include/linux/cache.h" #if !defined(____cacheline_internodealigned_in_smp) #if defined(CONFIG_SMP) #define ____cacheline_internodealigned_in_smp \ __attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT)))) #else # 74 "./include/linux/cache.h" #define ____cacheline_internodealigned_in_smp #endif # 76 "./include/linux/cache.h" #endif # 77 "./include/linux/cache.h" #ifndef CONFIG_ARCH_HAS_CACHE_LINE_SIZE #define cache_line_size() L1_CACHE_BYTES #endif # 81 "./include/linux/cache.h" #endif /* __LINUX_CACHE_H */ # 83 "./include/linux/cache.h" # 10 "./include/linux/printk.h" 2 extern const char linux_banner[]; extern const char linux_proc_banner[]; #define PRINTK_MAX_SINGLE_HEADER_LEN 2 static inline int printk_get_level(const char *buffer) { if (buffer[0] == KERN_SOH_ASCII && buffer[1]) { switch (buffer[1]) { case '0' ... '7': case 'd': /* KERN_DEFAULT */ case 'c': /* KERN_CONT */ return buffer[1]; } } return 0; } static inline const char *printk_skip_level(const char *buffer) { if (printk_get_level(buffer)) return buffer + 2; return buffer; } static inline const char *printk_skip_headers(const char *buffer) { while (printk_get_level(buffer)) buffer = printk_skip_level(buffer); return buffer; } #define CONSOLE_EXT_LOG_MAX 8192 /* printk's without a loglevel use this.. */ #define MESSAGE_LOGLEVEL_DEFAULT CONFIG_MESSAGE_LOGLEVEL_DEFAULT /* We show everything that is MORE important than this.. */ #define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */ #define CONSOLE_LOGLEVEL_MIN 1 /* Minimum loglevel we let people use */ #define CONSOLE_LOGLEVEL_QUIET 4 /* Shhh ..., when booted with "quiet" */ #define CONSOLE_LOGLEVEL_DEBUG 10 /* issue debug messages */ #define CONSOLE_LOGLEVEL_MOTORMOUTH 15 /* You can't shut this one up */ /* * Default used to be hard-coded at 7, we're now allowing it to be set from * kernel config. */ #define CONSOLE_LOGLEVEL_DEFAULT CONFIG_CONSOLE_LOGLEVEL_DEFAULT extern int console_printk[]; #define console_loglevel (console_printk[0]) #define default_message_loglevel (console_printk[1]) #define minimum_console_loglevel (console_printk[2]) #define default_console_loglevel (console_printk[3]) static inline void console_silent(void) { console_loglevel = CONSOLE_LOGLEVEL_SILENT; } static inline void console_verbose(void) { if (console_loglevel) console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH; } /* strlen("ratelimit") + 1 */ #define DEVKMSG_STR_MAX_SIZE 10 extern char devkmsg_log_str[]; struct ctl_table; struct va_format { const char *fmt; va_list *va; }; /* * FW_BUG * Add this to a message where you are sure the firmware is buggy or behaves * really stupid or out of spec. Be aware that the responsible BIOS developer * should be able to fix this issue or at least get a concrete idea of the * problem by reading your message without the need of looking at the kernel * code. * * Use it for definite and high priority BIOS bugs. * * FW_WARN * Use it for not that clear (e.g. could the kernel messed up things already?) * and medium priority BIOS bugs. * * FW_INFO * Use this one if you want to tell the user or vendor about something * suspicious, but generally harmless related to the firmware. * * Use it for information or very low priority BIOS bugs. */ #define FW_BUG "[Firmware Bug]: " #define FW_WARN "[Firmware Warn]: " #define FW_INFO "[Firmware Info]: " /* * HW_ERR * Add this to a message for hardware errors, so that user can report * it to hardware vendor instead of LKML or software vendor. */ #define HW_ERR "[Hardware Error]: " /* * DEPRECATED * Add this to a message whenever you want to warn user space about the use * of a deprecated aspect of an API so they can stop using it */ #define DEPRECATED "[Deprecated]: " /* * Dummy printk for disabled debugging statements to use whilst maintaining * gcc's format checking. */ #define no_printk(fmt, ...) \ ({ \ if (0) \ printk(fmt, ##__VA_ARGS__); \ 0; \ }) #ifdef CONFIG_EARLY_PRINTK extern asmlinkage __printf(1, 2) void early_printk(const char *fmt, ...); #else # 144 "./include/linux/printk.h" static inline __printf(1, 2) __cold void early_printk(const char *s, ...) { } #endif # 147 "./include/linux/printk.h" #ifdef CONFIG_PRINTK_NMI extern void printk_nmi_enter(void); extern void printk_nmi_exit(void); #else # 152 "./include/linux/printk.h" static inline void printk_nmi_enter(void) { } static inline void printk_nmi_exit(void) { } #endif /* PRINTK_NMI */ # 155 "./include/linux/printk.h" #ifdef CONFIG_PRINTK asmlinkage __printf(5, 0) int vprintk_emit(int facility, int level, const char *dict, size_t dictlen, const char *fmt, va_list args); asmlinkage __printf(1, 0) int vprintk(const char *fmt, va_list args); asmlinkage __printf(5, 6) __cold int printk_emit(int facility, int level, const char *dict, size_t dictlen, const char *fmt, ...); asmlinkage __printf(1, 2) __cold int printk(const char *fmt, ...); /* * Special printk facility for scheduler/timekeeping use only, _DO_NOT_USE_ ! */ __printf(1, 2) __cold int printk_deferred(const char *fmt, ...); /* * Please don't use printk_ratelimit(), because it shares ratelimiting state * with all other unrelated printk_ratelimit() callsites. Instead use * printk_ratelimited() or plain old __ratelimit(). */ extern int __printk_ratelimit(const char *func); #define printk_ratelimit() __printk_ratelimit(__func__) extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, unsigned int interval_msec); extern int printk_delay_msec; extern int dmesg_restrict; extern int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, void __user *buf, size_t *lenp, loff_t *ppos); extern void wake_up_klogd(void); char *log_buf_addr_get(void); u32 log_buf_len_get(void); void log_buf_vmcoreinfo_setup(void); void __init setup_log_buf(int early); __printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...); void dump_stack_print_info(const char *log_lvl); void show_regs_print_info(const char *log_lvl); extern void printk_safe_init(void); extern void printk_safe_flush(void); extern void printk_safe_flush_on_panic(void); #else # 208 "./include/linux/printk.h" static inline __printf(1, 0) int vprintk(const char *s, va_list args) { return 0; } static inline __printf(1, 2) __cold int printk(const char *s, ...) { return 0; } static inline __printf(1, 2) __cold int printk_deferred(const char *s, ...) { return 0; } static inline int printk_ratelimit(void) { return 0; } static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, unsigned int interval_msec) { return false; } static inline void wake_up_klogd(void) { } static inline char *log_buf_addr_get(void) { return NULL; } static inline u32 log_buf_len_get(void) { return 0; } static inline void log_buf_vmcoreinfo_setup(void) { } static inline void setup_log_buf(int early) { } static inline __printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...) { } static inline void dump_stack_print_info(const char *log_lvl) { } static inline void show_regs_print_info(const char *log_lvl) { } static inline void printk_safe_init(void) { } static inline void printk_safe_flush(void) { } static inline void printk_safe_flush_on_panic(void) { } #endif # 279 "./include/linux/printk.h" extern int kptr_restrict; extern asmlinkage void dump_stack(void) __cold; #ifndef pr_fmt #define pr_fmt(fmt) fmt #endif # 287 "./include/linux/printk.h" /* * These can be used to print at the various log levels. * All of these will print unconditionally, although note that pr_debug() * and other debug macros are compiled out unless either DEBUG is defined * or CONFIG_DYNAMIC_DEBUG is set. */ #define pr_emerg(fmt, ...) \ printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) #define pr_alert(fmt, ...) \ printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) #define pr_crit(fmt, ...) \ printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) #define pr_err(fmt, ...) \ printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) #define pr_warning(fmt, ...) \ printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) #define pr_warn pr_warning #define pr_notice(fmt, ...) \ printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) #define pr_info(fmt, ...) \ printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) /* * Like KERN_CONT, pr_cont() should only be used when continuing * a line with no newline ('\n') enclosed. Otherwise it defaults * back to KERN_DEFAULT. */ #define pr_cont(fmt, ...) \ printk(KERN_CONT fmt, ##__VA_ARGS__) /* pr_devel() should produce zero code unless DEBUG is defined */ #ifdef DEBUG #define pr_devel(fmt, ...) \ printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #else # 322 "./include/linux/printk.h" #define pr_devel(fmt, ...) \ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #endif # 325 "./include/linux/printk.h" /* If you are writing a driver, please use dev_dbg instead */ #if defined(CONFIG_DYNAMIC_DEBUG) #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 329 "./include/linux/printk.h" # 330 "./include/linux/printk.h" /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ #define pr_debug(fmt, ...) \ dynamic_pr_debug(fmt, ##__VA_ARGS__) #elif defined(DEBUG) # 335 "./include/linux/printk.h" #define pr_debug(fmt, ...) \ printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #else # 338 "./include/linux/printk.h" #define pr_debug(fmt, ...) \ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #endif # 341 "./include/linux/printk.h" /* * Print a one-time message (analogous to WARN_ONCE() et al): */ #ifdef CONFIG_PRINTK #define printk_once(fmt, ...) \ ({ \ static bool __print_once __read_mostly; \ bool __ret_print_once = !__print_once; \ \ if (!__print_once) { \ __print_once = true; \ printk(fmt, ##__VA_ARGS__); \ } \ unlikely(__ret_print_once); \ }) #define printk_deferred_once(fmt, ...) \ ({ \ static bool __print_once __read_mostly; \ bool __ret_print_once = !__print_once; \ \ if (!__print_once) { \ __print_once = true; \ printk_deferred(fmt, ##__VA_ARGS__); \ } \ unlikely(__ret_print_once); \ }) #else # 370 "./include/linux/printk.h" #define printk_once(fmt, ...) \ no_printk(fmt, ##__VA_ARGS__) #define printk_deferred_once(fmt, ...) \ no_printk(fmt, ##__VA_ARGS__) #endif # 375 "./include/linux/printk.h" #define pr_emerg_once(fmt, ...) \ printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) #define pr_alert_once(fmt, ...) \ printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) #define pr_crit_once(fmt, ...) \ printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) #define pr_err_once(fmt, ...) \ printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) #define pr_warn_once(fmt, ...) \ printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) #define pr_notice_once(fmt, ...) \ printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) #define pr_info_once(fmt, ...) \ printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) #define pr_cont_once(fmt, ...) \ printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__) #if defined(DEBUG) #define pr_devel_once(fmt, ...) \ printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #else # 397 "./include/linux/printk.h" #define pr_devel_once(fmt, ...) \ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #endif # 400 "./include/linux/printk.h" /* If you are writing a driver, please use dev_dbg instead */ #if defined(DEBUG) #define pr_debug_once(fmt, ...) \ printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #else # 406 "./include/linux/printk.h" #define pr_debug_once(fmt, ...) \ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #endif # 409 "./include/linux/printk.h" /* * ratelimited messages with local ratelimit_state, * no local ratelimit_state used in the !PRINTK case */ #ifdef CONFIG_PRINTK #define printk_ratelimited(fmt, ...) \ ({ \ static DEFINE_RATELIMIT_STATE(_rs, \ DEFAULT_RATELIMIT_INTERVAL, \ DEFAULT_RATELIMIT_BURST); \ \ if (__ratelimit(&_rs)) \ printk(fmt, ##__VA_ARGS__); \ }) #else # 425 "./include/linux/printk.h" #define printk_ratelimited(fmt, ...) \ no_printk(fmt, ##__VA_ARGS__) #endif # 428 "./include/linux/printk.h" #define pr_emerg_ratelimited(fmt, ...) \ printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) #define pr_alert_ratelimited(fmt, ...) \ printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) #define pr_crit_ratelimited(fmt, ...) \ printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) #define pr_err_ratelimited(fmt, ...) \ printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) #define pr_warn_ratelimited(fmt, ...) \ printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) #define pr_notice_ratelimited(fmt, ...) \ printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) #define pr_info_ratelimited(fmt, ...) \ printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) /* no pr_cont_ratelimited, don't do that... */ #if defined(DEBUG) #define pr_devel_ratelimited(fmt, ...) \ printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #else # 449 "./include/linux/printk.h" #define pr_devel_ratelimited(fmt, ...) \ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #endif # 452 "./include/linux/printk.h" /* If you are writing a driver, please use dev_dbg instead */ #if defined(CONFIG_DYNAMIC_DEBUG) /* descriptor check is first to prevent flooding with "callbacks suppressed" */ #define pr_debug_ratelimited(fmt, ...) \ do { \ static DEFINE_RATELIMIT_STATE(_rs, \ DEFAULT_RATELIMIT_INTERVAL, \ DEFAULT_RATELIMIT_BURST); \ DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, pr_fmt(fmt)); \ if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ __ratelimit(&_rs)) \ __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \ } while (0) #elif defined(DEBUG) # 467 "./include/linux/printk.h" #define pr_debug_ratelimited(fmt, ...) \ printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #else # 470 "./include/linux/printk.h" #define pr_debug_ratelimited(fmt, ...) \ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #endif # 473 "./include/linux/printk.h" extern const struct file_operations kmsg_fops; enum { DUMP_PREFIX_NONE, DUMP_PREFIX_ADDRESS, DUMP_PREFIX_OFFSET }; extern int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize, char *linebuf, size_t linebuflen, bool ascii); #ifdef CONFIG_PRINTK extern void print_hex_dump(const char *level, const char *prefix_str, int prefix_type, int rowsize, int groupsize, const void *buf, size_t len, bool ascii); #if defined(CONFIG_DYNAMIC_DEBUG) #define print_hex_dump_bytes(prefix_str, prefix_type, buf, len) \ dynamic_hex_dump(prefix_str, prefix_type, 16, 1, buf, len, true) #else # 492 "./include/linux/printk.h" extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, const void *buf, size_t len); #endif /* defined(CONFIG_DYNAMIC_DEBUG) */ # 495 "./include/linux/printk.h" #else # 496 "./include/linux/printk.h" static inline void print_hex_dump(const char *level, const char *prefix_str, int prefix_type, int rowsize, int groupsize, const void *buf, size_t len, bool ascii) { } static inline void print_hex_dump_bytes(const char *prefix_str, int prefix_type, const void *buf, size_t len) { } #endif # 507 "./include/linux/printk.h" #if defined(CONFIG_DYNAMIC_DEBUG) #define print_hex_dump_debug(prefix_str, prefix_type, rowsize, \ groupsize, buf, len, ascii) \ dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ groupsize, buf, len, ascii) #elif defined(DEBUG) # 514 "./include/linux/printk.h" #define print_hex_dump_debug(prefix_str, prefix_type, rowsize, \ groupsize, buf, len, ascii) \ print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize, \ groupsize, buf, len, ascii) #else # 519 "./include/linux/printk.h" static inline void print_hex_dump_debug(const char *prefix_str, int prefix_type, int rowsize, int groupsize, const void *buf, size_t len, bool ascii) { } #endif # 525 "./include/linux/printk.h" #endif # 527 "./include/linux/printk.h" # 15 "./include/linux/kernel.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 15 "./include/linux/kernel.h" # 1 "./include/linux/build_bug.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_BUILD_BUG_H #define _LINUX_BUILD_BUG_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/linux/build_bug.h" # 6 "./include/linux/build_bug.h" #ifdef __CHECKER__ #define __BUILD_BUG_ON_NOT_POWER_OF_2(n) (0) #define BUILD_BUG_ON_NOT_POWER_OF_2(n) (0) #define BUILD_BUG_ON_ZERO(e) (0) #define BUILD_BUG_ON_NULL(e) ((void *)0) #define BUILD_BUG_ON_INVALID(e) (0) #define BUILD_BUG_ON_MSG(cond, msg) (0) #define BUILD_BUG_ON(condition) (0) #define BUILD_BUG() (0) #else /* __CHECKER__ */ # 17 "./include/linux/build_bug.h" /* Force a compilation error if a constant expression is not a power of 2 */ #define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \ BUILD_BUG_ON(((n) & ((n) - 1)) != 0) #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) /* * Force a compilation error if condition is true, but also produce a * result (of value 0 and type size_t), so the expression can be used * e.g. in a structure initializer (or where-ever else comma expressions * aren't permitted). */ #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); })) #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:(-!!(e)); })) /* * BUILD_BUG_ON_INVALID() permits the compiler to check the validity of the * expression but avoids the generation of any code, even if that expression * has side-effects. */ #define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e)))) /** * BUILD_BUG_ON_MSG - break compile if a condition is true & emit supplied * error message. * @condition: the condition which the compiler should know is false. * * See BUILD_BUG_ON for description. */ #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) /** * BUILD_BUG_ON - break compile if a condition is true. * @condition: the condition which the compiler should know is false. * * If you have some code which relies on certain constants being equal, or * some other compile-time-evaluated condition, you should use BUILD_BUG_ON to * detect if someone changes it. * * The implementation uses gcc's reluctance to create a negative array, but gcc * (as of 4.4) only emits that error for obvious cases (e.g. not arguments to * inline functions). Luckily, in 4.3 they added the "error" function * attribute just for this type of case. Thus, we use a negative sized array * (should always create an error on gcc versions older than 4.4) and then call * an undefined function with the error attribute (should always create an * error on gcc 4.3 and later). If for some reason, neither creates a * compile-time error, we'll still have a link-time error, which is harder to * track down. */ #ifndef __OPTIMIZE__ #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) #else # 70 "./include/linux/build_bug.h" #define BUILD_BUG_ON(condition) \ BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) #endif # 73 "./include/linux/build_bug.h" /** * BUILD_BUG - break compile if used. * * If you have some code that you expect the compiler to eliminate at * build time, you should use BUILD_BUG to detect if it is * unexpectedly used. */ #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") #endif /* __CHECKER__ */ # 84 "./include/linux/build_bug.h" #endif /* _LINUX_BUILD_BUG_H */ # 86 "./include/linux/build_bug.h" # 16 "./include/linux/kernel.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 16 "./include/linux/kernel.h" # 17 "./include/linux/kernel.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 17 "./include/linux/kernel.h" # 18 "./include/linux/kernel.h" #define USHRT_MAX ((u16)(~0U)) #define SHRT_MAX ((s16)(USHRT_MAX>>1)) #define SHRT_MIN ((s16)(-SHRT_MAX - 1)) #define INT_MAX ((int)(~0U>>1)) #define INT_MIN (-INT_MAX - 1) #define UINT_MAX (~0U) #define LONG_MAX ((long)(~0UL>>1)) #define LONG_MIN (-LONG_MAX - 1) #define ULONG_MAX (~0UL) #define LLONG_MAX ((long long)(~0ULL>>1)) #define LLONG_MIN (-LLONG_MAX - 1) #define ULLONG_MAX (~0ULL) #define SIZE_MAX (~(size_t)0) #define U8_MAX ((u8)~0U) #define S8_MAX ((s8)(U8_MAX>>1)) #define S8_MIN ((s8)(-S8_MAX - 1)) #define U16_MAX ((u16)~0U) #define S16_MAX ((s16)(U16_MAX>>1)) #define S16_MIN ((s16)(-S16_MAX - 1)) #define U32_MAX ((u32)~0U) #define S32_MAX ((s32)(U32_MAX>>1)) #define S32_MIN ((s32)(-S32_MAX - 1)) #define U64_MAX ((u64)~0ULL) #define S64_MAX ((s64)(U64_MAX>>1)) #define S64_MIN ((s64)(-S64_MAX - 1)) #define STACK_MAGIC 0xdeadbeef /** * REPEAT_BYTE - repeat the value @x multiple times as an unsigned long value * @x: value to repeat * * NOTE: @x is not checked for > 0xff; larger values produce odd results. */ #define REPEAT_BYTE(x) ((~0ul / 0xff) * (x)) /* @a is a power of 2 value */ #define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) #define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) #define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask)) #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) /* generic data direction definitions */ #define READ 0 #define WRITE 1 /** * ARRAY_SIZE - get the number of elements in array @arr * @arr: array to be sized */ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) #define u64_to_user_ptr(x) ( \ { \ typecheck(u64, x); \ (void __user *)(uintptr_t)x; \ } \ ) /* * This looks more complex than it should be. But we need to * get the type for the ~ right in round_down (it needs to be * as wide as the result!), and we want to evaluate the macro * arguments just once each. */ #define __round_mask(x, y) ((__typeof__(x))((y)-1)) #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) #define round_down(x, y) ((x) & ~__round_mask(x, y)) /** * FIELD_SIZEOF - get the size of a struct's field * @t: the target struct * @f: the target struct's field * Return: the size of @f in the struct definition without having a * declared instance of @t. */ #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP #define DIV_ROUND_DOWN_ULL(ll, d) \ ({ unsigned long long _tmp = (ll); do_div(_tmp, d); _tmp; }) #define DIV_ROUND_UP_ULL(ll, d) DIV_ROUND_DOWN_ULL((ll) + (d) - 1, (d)) #if BITS_PER_LONG == 32 # define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP_ULL(ll, d) #else # 109 "./include/linux/kernel.h" # define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP(ll,d) #endif # 111 "./include/linux/kernel.h" /* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */ #define roundup(x, y) ( \ { \ const typeof(y) __y = y; \ (((x) + (__y - 1)) / __y) * __y; \ } \ ) #define rounddown(x, y) ( \ { \ typeof(x) __x = (x); \ __x - (__x % (y)); \ } \ ) /* * Divide positive or negative dividend by positive or negative divisor * and round to closest integer. Result is undefined for negative * divisors if the dividend variable type is unsigned and for negative * dividends if the divisor variable type is unsigned. */ #define DIV_ROUND_CLOSEST(x, divisor)( \ { \ typeof(x) __x = x; \ typeof(divisor) __d = divisor; \ (((typeof(x))-1) > 0 || \ ((typeof(divisor))-1) > 0 || \ (((__x) > 0) == ((__d) > 0))) ? \ (((__x) + ((__d) / 2)) / (__d)) : \ (((__x) - ((__d) / 2)) / (__d)); \ } \ ) /* * Same as above but for u64 dividends. divisor must be a 32-bit * number. */ #define DIV_ROUND_CLOSEST_ULL(x, divisor)( \ { \ typeof(divisor) __d = divisor; \ unsigned long long _tmp = (x) + (__d) / 2; \ do_div(_tmp, __d); \ _tmp; \ } \ ) /* * Multiplies an integer by a fraction, while avoiding unnecessary * overflow or loss of precision. */ #define mult_frac(x, numer, denom)( \ { \ typeof(x) quot = (x) / (denom); \ typeof(x) rem = (x) % (denom); \ (quot * (numer)) + ((rem * (numer)) / (denom)); \ } \ ) #define _RET_IP_ (unsigned long)__builtin_return_address(0) #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) #ifdef CONFIG_LBDAF #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 173 "./include/linux/kernel.h" # 1 "./arch/x86/include/asm/div64.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_DIV64_H #define _ASM_X86_DIV64_H #ifdef CONFIG_X86_32 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 7 "./arch/x86/include/asm/div64.h" # 8 "./arch/x86/include/asm/div64.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 8 "./arch/x86/include/asm/div64.h" # 9 "./arch/x86/include/asm/div64.h" /* * do_div() is NOT a C function. It wants to return * two values (the quotient and the remainder), but * since that doesn't work very well in C, what it * does is: * * - modifies the 64-bit dividend _in_place_ * - returns the 32-bit remainder * * This ends up being the most efficient "calling * convention" on x86. */ #define do_div(n, base) \ ({ \ unsigned long __upper, __low, __high, __mod, __base; \ __base = (base); \ if (__builtin_constant_p(__base) && is_power_of_2(__base)) { \ __mod = n & (__base - 1); \ n >>= ilog2(__base); \ } else { \ asm("" : "=a" (__low), "=d" (__high) : "A" (n));\ __upper = __high; \ if (__high) { \ __upper = __high % (__base); \ __high = __high / (__base); \ } \ asm("divl %2" : "=a" (__low), "=d" (__mod) \ : "rm" (__base), "0" (__low), "1" (__upper)); \ asm("" : "=A" (n) : "a" (__low), "d" (__high)); \ } \ __mod; \ }) static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) { union { u64 v64; u32 v32[2]; } d = { dividend }; u32 upper; upper = d.v32[1]; d.v32[1] = 0; if (upper >= divisor) { d.v32[1] = upper / divisor; upper %= divisor; } asm ("divl %2" : "=a" (d.v32[0]), "=d" (*remainder) : "rm" (divisor), "0" (d.v32[0]), "1" (upper)); return d.v64; } #define div_u64_rem div_u64_rem static inline u64 mul_u32_u32(u32 a, u32 b) { u32 high, low; asm ("mull %[b]" : "=a" (low), "=d" (high) : [a] "a" (a), [b] "rm" (b) ); return low | ((u64)high) << 32; } #define mul_u32_u32 mul_u32_u32 #else # 75 "./arch/x86/include/asm/div64.h" #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 75 "./arch/x86/include/asm/div64.h" # 76 "./arch/x86/include/asm/div64.h" #endif /* CONFIG_X86_32 */ # 77 "./arch/x86/include/asm/div64.h" #endif /* _ASM_X86_DIV64_H */ # 79 "./arch/x86/include/asm/div64.h" # 174 "./include/linux/kernel.h" 2 # define sector_div(a, b) do_div(a, b) #else # 176 "./include/linux/kernel.h" # define sector_div(n, b)( \ { \ int _res; \ _res = (n) % (b); \ (n) /= (b); \ _res; \ } \ ) #endif # 185 "./include/linux/kernel.h" /** * upper_32_bits - return bits 32-63 of a number * @n: the number we're accessing * * A basic shift-right of a 64- or 32-bit quantity. Use this to suppress * the "right shift count >= width of type" warning when that quantity is * 32-bits. */ #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) /** * lower_32_bits - return bits 0-31 of a number * @n: the number we're accessing */ #define lower_32_bits(n) ((u32)(n)) struct completion; struct pt_regs; struct user; #ifdef CONFIG_PREEMPT_VOLUNTARY extern int _cond_resched(void); # define might_resched() _cond_resched() #else # 210 "./include/linux/kernel.h" # define might_resched() do { } while (0) #endif # 212 "./include/linux/kernel.h" #ifdef CONFIG_DEBUG_ATOMIC_SLEEP void ___might_sleep(const char *file, int line, int preempt_offset); void __might_sleep(const char *file, int line, int preempt_offset); /** * might_sleep - annotation for functions that can sleep * * this macro will print a stack trace if it is executed in an atomic * context (spinlock, irq-handler, ...). * * This is a useful debugging help to be able to catch problems early and not * be bitten later when the calling function happens to sleep when it is not * supposed to. */ # define might_sleep() \ do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0) # define sched_annotate_sleep() (current->task_state_change = 0) #else # 230 "./include/linux/kernel.h" static inline void ___might_sleep(const char *file, int line, int preempt_offset) { } static inline void __might_sleep(const char *file, int line, int preempt_offset) { } # define might_sleep() do { might_resched(); } while (0) # define sched_annotate_sleep() do { } while (0) #endif # 237 "./include/linux/kernel.h" #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) /** * abs - return absolute value of an argument * @x: the value. If it is unsigned type, it is converted to signed type first. * char is treated as if it was signed (regardless of whether it really is) * but the macro's return type is preserved as char. * * Return: an absolute value of x. */ #define abs(x) __abs_choose_expr(x, long long, \ __abs_choose_expr(x, long, \ __abs_choose_expr(x, int, \ __abs_choose_expr(x, short, \ __abs_choose_expr(x, char, \ __builtin_choose_expr( \ __builtin_types_compatible_p(typeof(x), char), \ (char)({ signed char __x = (x); __x<0?-__x:__x; }), \ ((void)0))))))) #define __abs_choose_expr(x, type, other) __builtin_choose_expr( \ __builtin_types_compatible_p(typeof(x), signed type) || \ __builtin_types_compatible_p(typeof(x), unsigned type), \ ({ signed type __x = (x); __x < 0 ? -__x : __x; }), other) /** * reciprocal_scale - "scale" a value into range [0, ep_ro) * @val: value * @ep_ro: right open interval endpoint * * Perform a "reciprocal multiplication" in order to "scale" a value into * range [0, @ep_ro), where the upper interval endpoint is right-open. * This is useful, e.g. for accessing a index of an array containing * @ep_ro elements, for example. Think of it as sort of modulus, only that * the result isn't that of modulo. ;) Note that if initial input is a * small value, then result will return 0. * * Return: a result based on @val in interval [0, @ep_ro). */ static inline u32 reciprocal_scale(u32 val, u32 ep_ro) { return (u32)(((u64) val * ep_ro) >> 32); } #if defined(CONFIG_MMU) && \ (defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP)) #define might_fault() __might_fault(__FILE__, __LINE__) void __might_fault(const char *file, int line); #else # 287 "./include/linux/kernel.h" static inline void might_fault(void) { } #endif # 289 "./include/linux/kernel.h" extern struct atomic_notifier_head panic_notifier_list; extern long (*panic_blink)(int state); __printf(1, 2) void panic(const char *fmt, ...) __noreturn __cold; void nmi_panic(struct pt_regs *regs, const char *msg); extern void oops_enter(void); extern void oops_exit(void); void print_oops_end_marker(void); extern int oops_may_print(void); void do_exit(long error_code) __noreturn; void complete_and_exit(struct completion *, long) __noreturn; #ifdef CONFIG_ARCH_HAS_REFCOUNT void refcount_error_report(struct pt_regs *regs, const char *err); #else # 305 "./include/linux/kernel.h" static inline void refcount_error_report(struct pt_regs *regs, const char *err) { } #endif # 308 "./include/linux/kernel.h" /* Internal, do not use. */ int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res); int __must_check _kstrtol(const char *s, unsigned int base, long *res); int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res); int __must_check kstrtoll(const char *s, unsigned int base, long long *res); /** * kstrtoul - convert a string to an unsigned long * @s: The start of the string. The string must be null-terminated, and may also * include a single newline before its terminating null. The first character * may also be a plus sign, but not a minus sign. * @base: The number base to use. The maximum supported base is 16. If base is * given as 0, then the base of the string is automatically detected with the * conventional semantics - If it begins with 0x the number will be parsed as a * hexadecimal (case insensitive), if it otherwise begins with 0, it will be * parsed as an octal number. Otherwise it will be parsed as a decimal. * @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. * Used as a replacement for the obsolete simple_strtoull. Return code must * be checked. */ static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res) { /* * We want to shortcut function call, but * __builtin_types_compatible_p(unsigned long, unsigned long long) = 0. */ if (sizeof(unsigned long) == sizeof(unsigned long long) && __alignof__(unsigned long) == __alignof__(unsigned long long)) return kstrtoull(s, base, (unsigned long long *)res); else return _kstrtoul(s, base, res); } /** * kstrtol - convert a string to a long * @s: The start of the string. The string must be null-terminated, and may also * include a single newline before its terminating null. The first character * may also be a plus sign or a minus sign. * @base: The number base to use. The maximum supported base is 16. If base is * given as 0, then the base of the string is automatically detected with the * conventional semantics - If it begins with 0x the number will be parsed as a * hexadecimal (case insensitive), if it otherwise begins with 0, it will be * parsed as an octal number. Otherwise it will be parsed as a decimal. * @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. * Used as a replacement for the obsolete simple_strtoull. Return code must * be checked. */ static inline int __must_check kstrtol(const char *s, unsigned int base, long *res) { /* * We want to shortcut function call, but * __builtin_types_compatible_p(long, long long) = 0. */ if (sizeof(long) == sizeof(long long) && __alignof__(long) == __alignof__(long long)) return kstrtoll(s, base, (long long *)res); else return _kstrtol(s, base, res); } int __must_check kstrtouint(const char *s, unsigned int base, unsigned int *res); int __must_check kstrtoint(const char *s, unsigned int base, int *res); static inline int __must_check kstrtou64(const char *s, unsigned int base, u64 *res) { return kstrtoull(s, base, res); } static inline int __must_check kstrtos64(const char *s, unsigned int base, s64 *res) { return kstrtoll(s, base, res); } static inline int __must_check kstrtou32(const char *s, unsigned int base, u32 *res) { return kstrtouint(s, base, res); } static inline int __must_check kstrtos32(const char *s, unsigned int base, s32 *res) { return kstrtoint(s, base, res); } int __must_check kstrtou16(const char *s, unsigned int base, u16 *res); int __must_check kstrtos16(const char *s, unsigned int base, s16 *res); int __must_check kstrtou8(const char *s, unsigned int base, u8 *res); int __must_check kstrtos8(const char *s, unsigned int base, s8 *res); int __must_check kstrtobool(const char *s, bool *res); int __must_check kstrtoull_from_user(const char __user *s, size_t count, unsigned int base, unsigned long long *res); int __must_check kstrtoll_from_user(const char __user *s, size_t count, unsigned int base, long long *res); int __must_check kstrtoul_from_user(const char __user *s, size_t count, unsigned int base, unsigned long *res); int __must_check kstrtol_from_user(const char __user *s, size_t count, unsigned int base, long *res); int __must_check kstrtouint_from_user(const char __user *s, size_t count, unsigned int base, unsigned int *res); int __must_check kstrtoint_from_user(const char __user *s, size_t count, unsigned int base, int *res); int __must_check kstrtou16_from_user(const char __user *s, size_t count, unsigned int base, u16 *res); int __must_check kstrtos16_from_user(const char __user *s, size_t count, unsigned int base, s16 *res); int __must_check kstrtou8_from_user(const char __user *s, size_t count, unsigned int base, u8 *res); int __must_check kstrtos8_from_user(const char __user *s, size_t count, unsigned int base, s8 *res); int __must_check kstrtobool_from_user(const char __user *s, size_t count, bool *res); static inline int __must_check kstrtou64_from_user(const char __user *s, size_t count, unsigned int base, u64 *res) { return kstrtoull_from_user(s, count, base, res); } static inline int __must_check kstrtos64_from_user(const char __user *s, size_t count, unsigned int base, s64 *res) { return kstrtoll_from_user(s, count, base, res); } static inline int __must_check kstrtou32_from_user(const char __user *s, size_t count, unsigned int base, u32 *res) { return kstrtouint_from_user(s, count, base, res); } static inline int __must_check kstrtos32_from_user(const char __user *s, size_t count, unsigned int base, s32 *res) { return kstrtoint_from_user(s, count, base, res); } /* Obsolete, do not use. Use kstrto instead */ extern unsigned long simple_strtoul(const char *,char **,unsigned int); extern long simple_strtol(const char *,char **,unsigned int); extern unsigned long long simple_strtoull(const char *,char **,unsigned int); extern long long simple_strtoll(const char *,char **,unsigned int); extern int num_to_str(char *buf, int size, unsigned long long num); /* lib/printf utilities */ extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...); extern __printf(2, 0) int vsprintf(char *buf, const char *, va_list); extern __printf(3, 4) int snprintf(char *buf, size_t size, const char *fmt, ...); extern __printf(3, 0) int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); extern __printf(3, 4) int scnprintf(char *buf, size_t size, const char *fmt, ...); extern __printf(3, 0) int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); extern __printf(2, 3) __malloc char *kasprintf(gfp_t gfp, const char *fmt, ...); extern __printf(2, 0) __malloc char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); extern __printf(2, 0) const char *kvasprintf_const(gfp_t gfp, const char *fmt, va_list args); extern __scanf(2, 3) int sscanf(const char *, const char *, ...); extern __scanf(2, 0) int vsscanf(const char *, const char *, va_list); extern int get_option(char **str, int *pint); extern char *get_options(const char *str, int nints, int *ints); extern unsigned long long memparse(const char *ptr, char **retptr); extern bool parse_option_str(const char *str, const char *option); extern char *next_arg(char *args, char **param, char **val); extern int core_kernel_text(unsigned long addr); extern int core_kernel_data(unsigned long addr); extern int __kernel_text_address(unsigned long addr); extern int kernel_text_address(unsigned long addr); extern int func_ptr_is_kernel_text(void *ptr); unsigned long int_sqrt(unsigned long); extern void bust_spinlocks(int yes); extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ extern int panic_timeout; extern int panic_on_oops; extern int panic_on_unrecovered_nmi; extern int panic_on_io_nmi; extern int panic_on_warn; extern int sysctl_panic_on_rcu_stall; extern int sysctl_panic_on_stackoverflow; extern bool crash_kexec_post_notifiers; /* * panic_cpu is used for synchronizing panic() and crash_kexec() execution. It * holds a CPU number which is executing panic() currently. A value of * PANIC_CPU_INVALID means no CPU has entered panic() or crash_kexec(). */ extern atomic_t panic_cpu; #define PANIC_CPU_INVALID -1 /* * Only to be used by arch init code. If the user over-wrote the default * CONFIG_PANIC_TIMEOUT, honor it. */ static inline void set_arch_panic_timeout(int timeout, int arch_default_timeout) { if (panic_timeout == arch_default_timeout) panic_timeout = timeout; } extern const char *print_tainted(void); enum lockdep_ok { LOCKDEP_STILL_OK, LOCKDEP_NOW_UNRELIABLE }; extern void add_taint(unsigned flag, enum lockdep_ok); extern int test_taint(unsigned flag); extern unsigned long get_taint(void); extern int root_mountflags; extern bool early_boot_irqs_disabled; /* * Values used for system_state. Ordering of the states must not be changed * as code checks for <, <=, >, >= STATE. */ extern enum system_states { SYSTEM_BOOTING, SYSTEM_SCHEDULING, SYSTEM_RUNNING, SYSTEM_HALT, SYSTEM_POWER_OFF, SYSTEM_RESTART, } system_state; #define TAINT_PROPRIETARY_MODULE 0 #define TAINT_FORCED_MODULE 1 #define TAINT_CPU_OUT_OF_SPEC 2 #define TAINT_FORCED_RMMOD 3 #define TAINT_MACHINE_CHECK 4 #define TAINT_BAD_PAGE 5 #define TAINT_USER 6 #define TAINT_DIE 7 #define TAINT_OVERRIDDEN_ACPI_TABLE 8 #define TAINT_WARN 9 #define TAINT_CRAP 10 #define TAINT_FIRMWARE_WORKAROUND 11 #define TAINT_OOT_MODULE 12 #define TAINT_UNSIGNED_MODULE 13 #define TAINT_SOFTLOCKUP 14 #define TAINT_LIVEPATCH 15 #define TAINT_AUX 16 #define TAINT_FLAGS_COUNT 17 struct taint_flag { char c_true; /* character printed when tainted */ char c_false; /* character printed when not tainted */ bool module; /* also show as a per-module taint flag */ }; extern const struct taint_flag taint_flags[TAINT_FLAGS_COUNT]; extern const char hex_asc[]; #define hex_asc_lo(x) hex_asc[((x) & 0x0f)] #define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4] static inline char *hex_byte_pack(char *buf, u8 byte) { *buf++ = hex_asc_hi(byte); *buf++ = hex_asc_lo(byte); return buf; } extern const char hex_asc_upper[]; #define hex_asc_upper_lo(x) hex_asc_upper[((x) & 0x0f)] #define hex_asc_upper_hi(x) hex_asc_upper[((x) & 0xf0) >> 4] static inline char *hex_byte_pack_upper(char *buf, u8 byte) { *buf++ = hex_asc_upper_hi(byte); *buf++ = hex_asc_upper_lo(byte); return buf; } extern int hex_to_bin(char ch); extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); extern char *bin2hex(char *dst, const void *src, size_t count); bool mac_pton(const char *s, u8 *mac); /* * General tracing related utility functions - trace_printk(), * tracing_on/tracing_off and tracing_start()/tracing_stop * * Use tracing_on/tracing_off when you want to quickly turn on or off * tracing. It simply enables or disables the recording of the trace events. * This also corresponds to the user space /sys/kernel/debug/tracing/tracing_on * file, which gives a means for the kernel and userspace to interact. * Place a tracing_off() in the kernel where you want tracing to end. * From user space, examine the trace, and then echo 1 > tracing_on * to continue tracing. * * tracing_stop/tracing_start has slightly more overhead. It is used * by things like suspend to ram where disabling the recording of the * trace is not enough, but tracing must actually stop because things * like calling smp_processor_id() may crash the system. * * Most likely, you want to use tracing_on/tracing_off. */ enum ftrace_dump_mode { DUMP_NONE, DUMP_ALL, DUMP_ORIG, }; #ifdef CONFIG_TRACING void tracing_on(void); void tracing_off(void); int tracing_is_on(void); void tracing_snapshot(void); void tracing_snapshot_alloc(void); extern void tracing_start(void); extern void tracing_stop(void); static inline __printf(1, 2) void ____trace_printk_check_format(const char *fmt, ...) { } #define __trace_printk_check_format(fmt, args...) \ do { \ if (0) \ ____trace_printk_check_format(fmt, ##args); \ } while (0) /** * trace_printk - printf formatting in the ftrace buffer * @fmt: the printf format for printing * * Note: __trace_printk is an internal function for trace_printk() and * the @ip is passed in via the trace_printk() macro. * * This function allows a kernel developer to debug fast path sections * that printk is not appropriate for. By scattering in various * printk like tracing in the code, a developer can quickly see * where problems are occurring. * * This is intended as a debugging tool for the developer only. * Please refrain from leaving trace_printks scattered around in * your code. (Extra memory is used for special buffers that are * allocated when trace_printk() is used.) * * A little optization trick is done here. If there's only one * argument, there's no need to scan the string for printf formats. * The trace_puts() will suffice. But how can we take advantage of * using trace_puts() when trace_printk() has only one argument? * By stringifying the args and checking the size we can tell * whether or not there are args. __stringify((__VA_ARGS__)) will * turn into "()\0" with a size of 3 when there are no args, anything * else will be bigger. All we need to do is define a string to this, * and then take its size and compare to 3. If it's bigger, use * do_trace_printk() otherwise, optimize it to trace_puts(). Then just * let gcc optimize the rest. */ #define trace_printk(fmt, ...) \ do { \ char _______STR[] = __stringify((__VA_ARGS__)); \ if (sizeof(_______STR) > 3) \ do_trace_printk(fmt, ##__VA_ARGS__); \ else \ trace_puts(fmt); \ } while (0) #define do_trace_printk(fmt, args...) \ do { \ static const char *trace_printk_fmt __used \ __attribute__((section("__trace_printk_fmt"))) = \ __builtin_constant_p(fmt) ? fmt : NULL; \ \ __trace_printk_check_format(fmt, ##args); \ \ if (__builtin_constant_p(fmt)) \ __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \ else \ __trace_printk(_THIS_IP_, fmt, ##args); \ } while (0) extern __printf(2, 3) int __trace_bprintk(unsigned long ip, const char *fmt, ...); extern __printf(2, 3) int __trace_printk(unsigned long ip, const char *fmt, ...); /** * trace_puts - write a string into the ftrace buffer * @str: the string to record * * Note: __trace_bputs is an internal function for trace_puts and * the @ip is passed in via the trace_puts macro. * * This is similar to trace_printk() but is made for those really fast * paths that a developer wants the least amount of "Heisenbug" effects, * where the processing of the print format is still too much. * * This function allows a kernel developer to debug fast path sections * that printk is not appropriate for. By scattering in various * printk like tracing in the code, a developer can quickly see * where problems are occurring. * * This is intended as a debugging tool for the developer only. * Please refrain from leaving trace_puts scattered around in * your code. (Extra memory is used for special buffers that are * allocated when trace_puts() is used.) * * Returns: 0 if nothing was written, positive # if string was. * (1 when __trace_bputs is used, strlen(str) when __trace_puts is used) */ #define trace_puts(str) ({ \ static const char *trace_printk_fmt __used \ __attribute__((section("__trace_printk_fmt"))) = \ __builtin_constant_p(str) ? str : NULL; \ \ if (__builtin_constant_p(str)) \ __trace_bputs(_THIS_IP_, trace_printk_fmt); \ else \ __trace_puts(_THIS_IP_, str, strlen(str)); \ }) extern int __trace_bputs(unsigned long ip, const char *str); extern int __trace_puts(unsigned long ip, const char *str, int size); extern void trace_dump_stack(int skip); /* * The double __builtin_constant_p is because gcc will give us an error * if we try to allocate the static variable to fmt if it is not a * constant. Even with the outer if statement. */ #define ftrace_vprintk(fmt, vargs) \ do { \ if (__builtin_constant_p(fmt)) { \ static const char *trace_printk_fmt __used \ __attribute__((section("__trace_printk_fmt"))) = \ __builtin_constant_p(fmt) ? fmt : NULL; \ \ __ftrace_vbprintk(_THIS_IP_, trace_printk_fmt, vargs); \ } else \ __ftrace_vprintk(_THIS_IP_, fmt, vargs); \ } while (0) extern __printf(2, 0) int __ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap); extern __printf(2, 0) int __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode); #else # 761 "./include/linux/kernel.h" static inline void tracing_start(void) { } static inline void tracing_stop(void) { } static inline void trace_dump_stack(int skip) { } static inline void tracing_on(void) { } static inline void tracing_off(void) { } static inline int tracing_is_on(void) { return 0; } static inline void tracing_snapshot(void) { } static inline void tracing_snapshot_alloc(void) { } static inline __printf(1, 2) int trace_printk(const char *fmt, ...) { return 0; } static __printf(1, 0) inline int ftrace_vprintk(const char *fmt, va_list ap) { return 0; } static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } #endif /* CONFIG_TRACING */ # 783 "./include/linux/kernel.h" /* * min()/max()/clamp() macros that also do * strict type-checking.. See the * "unnecessary" pointer comparison. */ #define __min(t1, t2, min1, min2, x, y) ({ \ t1 min1 = (x); \ t2 min2 = (y); \ (void) (&min1 == &min2); \ min1 < min2 ? min1 : min2; }) /** * min - return minimum of two values of the same or compatible types * @x: first value * @y: second value */ #define min(x, y) \ __min(typeof(x), typeof(y), \ __UNIQUE_ID(min1_), __UNIQUE_ID(min2_), \ x, y) #define __max(t1, t2, max1, max2, x, y) ({ \ t1 max1 = (x); \ t2 max2 = (y); \ (void) (&max1 == &max2); \ max1 > max2 ? max1 : max2; }) /** * max - return maximum of two values of the same or compatible types * @x: first value * @y: second value */ #define max(x, y) \ __max(typeof(x), typeof(y), \ __UNIQUE_ID(max1_), __UNIQUE_ID(max2_), \ x, y) /** * min3 - return minimum of three values * @x: first value * @y: second value * @z: third value */ #define min3(x, y, z) min((typeof(x))min(x, y), z) /** * max3 - return maximum of three values * @x: first value * @y: second value * @z: third value */ #define max3(x, y, z) max((typeof(x))max(x, y), z) /** * min_not_zero - return the minimum that is _not_ zero, unless both are zero * @x: value1 * @y: value2 */ #define min_not_zero(x, y) ({ \ typeof(x) __x = (x); \ typeof(y) __y = (y); \ __x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); }) /** * clamp - return a value clamped to a given range with strict typechecking * @val: current value * @lo: lowest allowable value * @hi: highest allowable value * * This macro does strict typechecking of @lo/@hi to make sure they are of the * same type as @val. See the unnecessary pointer comparisons. */ #define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi) /* * ..and if you can't take the strict * types, you can specify one yourself. * * Or not use min/max/clamp at all, of course. */ /** * min_t - return minimum of two values, using the specified type * @type: data type to use * @x: first value * @y: second value */ #define min_t(type, x, y) \ __min(type, type, \ __UNIQUE_ID(min1_), __UNIQUE_ID(min2_), \ x, y) /** * max_t - return maximum of two values, using the specified type * @type: data type to use * @x: first value * @y: second value */ #define max_t(type, x, y) \ __max(type, type, \ __UNIQUE_ID(min1_), __UNIQUE_ID(min2_), \ x, y) /** * clamp_t - return a value clamped to a given range using a given type * @type: the type of variable to use * @val: current value * @lo: minimum allowable value * @hi: maximum allowable value * * This macro does no typechecking and uses temporary variables of type * @type to make all the comparisons. */ #define clamp_t(type, val, lo, hi) min_t(type, max_t(type, val, lo), hi) /** * clamp_val - return a value clamped to a given range using val's type * @val: current value * @lo: minimum allowable value * @hi: maximum allowable value * * This macro does no typechecking and uses temporary variables of whatever * type the input argument @val is. This is useful when @val is an unsigned * type and @lo and @hi are literals that will otherwise be assigned a signed * integer type. */ #define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi) /** * swap - swap values of @a and @b * @a: first value * @b: second value */ #define swap(a, b) \ do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) /** * container_of - cast a member of a structure out to the containing structure * @ptr: the pointer to the member. * @type: the type of the container struct this is embedded in. * @member: the name of the member within the struct. * */ #define container_of(ptr, type, member) ({ \ void *__mptr = (void *)(ptr); \ BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ !__same_type(*(ptr), void), \ "pointer type mismatch in container_of()"); \ ((type *)(__mptr - offsetof(type, member))); }) /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ #ifdef CONFIG_FTRACE_MCOUNT_RECORD # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD #endif # 939 "./include/linux/kernel.h" /* Permissions on a sysfs file: you didn't miss the 0 prefix did you? */ #define VERIFY_OCTAL_PERMISSIONS(perms) \ (BUILD_BUG_ON_ZERO((perms) < 0) + \ BUILD_BUG_ON_ZERO((perms) > 0777) + \ /* USER_READABLE >= GROUP_READABLE >= OTHER_READABLE */ \ BUILD_BUG_ON_ZERO((((perms) >> 6) & 4) < (((perms) >> 3) & 4)) + \ BUILD_BUG_ON_ZERO((((perms) >> 3) & 4) < ((perms) & 4)) + \ /* USER_WRITABLE >= GROUP_WRITABLE */ \ BUILD_BUG_ON_ZERO((((perms) >> 6) & 2) < (((perms) >> 3) & 2)) + \ /* OTHER_WRITABLE? Generally considered a bad idea. */ \ BUILD_BUG_ON_ZERO((perms) & 2) + \ (perms)) #endif # 953 "./include/linux/kernel.h" # 19 "./include/asm-generic/bug.h" 2 #ifdef CONFIG_BUG #ifdef CONFIG_GENERIC_BUG struct bug_entry { #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS unsigned long bug_addr; #else # 27 "./include/asm-generic/bug.h" signed int bug_addr_disp; #endif # 29 "./include/asm-generic/bug.h" #ifdef CONFIG_DEBUG_BUGVERBOSE #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS const char *file; #else # 33 "./include/asm-generic/bug.h" signed int file_disp; #endif # 35 "./include/asm-generic/bug.h" unsigned short line; #endif # 37 "./include/asm-generic/bug.h" unsigned short flags; }; #endif /* CONFIG_GENERIC_BUG */ # 40 "./include/asm-generic/bug.h" /* * Don't use BUG() or BUG_ON() unless there's really no way out; one * example might be detecting data structure corruption in the middle * of an operation that can't be backed out of. If the (sub)system * can somehow continue operating, perhaps with reduced functionality, * it's probably not BUG-worthy. * * If you're tempted to BUG(), think again: is completely giving up * really the *only* solution? There are usually better options, where * users don't need to reboot ASAP and can mostly shut down cleanly. */ #ifndef HAVE_ARCH_BUG #define BUG() do { \ printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \ panic("BUG!"); \ } while (0) #endif # 58 "./include/asm-generic/bug.h" #ifndef HAVE_ARCH_BUG_ON #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) #endif # 62 "./include/asm-generic/bug.h" #ifdef __WARN_FLAGS #define __WARN_TAINT(taint) __WARN_FLAGS(BUGFLAG_TAINT(taint)) #define __WARN_ONCE_TAINT(taint) __WARN_FLAGS(BUGFLAG_ONCE|BUGFLAG_TAINT(taint)) #define WARN_ON_ONCE(condition) ({ \ int __ret_warn_on = !!(condition); \ if (unlikely(__ret_warn_on)) \ __WARN_ONCE_TAINT(TAINT_WARN); \ unlikely(__ret_warn_on); \ }) #endif # 74 "./include/asm-generic/bug.h" /* * WARN(), WARN_ON(), WARN_ON_ONCE, and so on can be used to report * significant issues that need prompt attention if they should ever * appear at runtime. Use the versions with printk format strings * to provide better diagnostics. */ #ifndef __WARN_TAINT extern __printf(3, 4) void warn_slowpath_fmt(const char *file, const int line, const char *fmt, ...); extern __printf(4, 5) void warn_slowpath_fmt_taint(const char *file, const int line, unsigned taint, const char *fmt, ...); extern void warn_slowpath_null(const char *file, const int line); #define WANT_WARN_ON_SLOWPATH #define __WARN() warn_slowpath_null(__FILE__, __LINE__) #define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg) #define __WARN_printf_taint(taint, arg...) \ warn_slowpath_fmt_taint(__FILE__, __LINE__, taint, arg) #else # 95 "./include/asm-generic/bug.h" extern __printf(1, 2) void __warn_printk(const char *fmt, ...); #define __WARN() __WARN_TAINT(TAINT_WARN) #define __WARN_printf(arg...) do { __warn_printk(arg); __WARN(); } while (0) #define __WARN_printf_taint(taint, arg...) \ do { __warn_printk(arg); __WARN_TAINT(taint); } while (0) #endif # 101 "./include/asm-generic/bug.h" /* used internally by panic.c */ struct warn_args; struct pt_regs; void __warn(const char *file, int line, void *caller, unsigned taint, struct pt_regs *regs, struct warn_args *args); #ifndef WARN_ON #define WARN_ON(condition) ({ \ int __ret_warn_on = !!(condition); \ if (unlikely(__ret_warn_on)) \ __WARN(); \ unlikely(__ret_warn_on); \ }) #endif # 117 "./include/asm-generic/bug.h" #ifndef WARN #define WARN(condition, format...) ({ \ int __ret_warn_on = !!(condition); \ if (unlikely(__ret_warn_on)) \ __WARN_printf(format); \ unlikely(__ret_warn_on); \ }) #endif # 126 "./include/asm-generic/bug.h" #define WARN_TAINT(condition, taint, format...) ({ \ int __ret_warn_on = !!(condition); \ if (unlikely(__ret_warn_on)) \ __WARN_printf_taint(taint, format); \ unlikely(__ret_warn_on); \ }) #ifndef WARN_ON_ONCE #define WARN_ON_ONCE(condition) ({ \ static bool __section(.data.once) __warned; \ int __ret_warn_once = !!(condition); \ \ if (unlikely(__ret_warn_once && !__warned)) { \ __warned = true; \ WARN_ON(1); \ } \ unlikely(__ret_warn_once); \ }) #endif # 146 "./include/asm-generic/bug.h" #define WARN_ONCE(condition, format...) ({ \ static bool __section(.data.once) __warned; \ int __ret_warn_once = !!(condition); \ \ if (unlikely(__ret_warn_once && !__warned)) { \ __warned = true; \ WARN(1, format); \ } \ unlikely(__ret_warn_once); \ }) #define WARN_TAINT_ONCE(condition, taint, format...) ({ \ static bool __section(.data.once) __warned; \ int __ret_warn_once = !!(condition); \ \ if (unlikely(__ret_warn_once && !__warned)) { \ __warned = true; \ WARN_TAINT(1, taint, format); \ } \ unlikely(__ret_warn_once); \ }) #else /* !CONFIG_BUG */ # 170 "./include/asm-generic/bug.h" #ifndef HAVE_ARCH_BUG #define BUG() do {} while (1) #endif # 173 "./include/asm-generic/bug.h" #ifndef HAVE_ARCH_BUG_ON #define BUG_ON(condition) do { if (condition) BUG(); } while (0) #endif # 177 "./include/asm-generic/bug.h" #ifndef HAVE_ARCH_WARN_ON #define WARN_ON(condition) ({ \ int __ret_warn_on = !!(condition); \ unlikely(__ret_warn_on); \ }) #endif # 184 "./include/asm-generic/bug.h" #ifndef WARN #define WARN(condition, format...) ({ \ int __ret_warn_on = !!(condition); \ no_printk(format); \ unlikely(__ret_warn_on); \ }) #endif # 192 "./include/asm-generic/bug.h" #define WARN_ON_ONCE(condition) WARN_ON(condition) #define WARN_ONCE(condition, format...) WARN(condition, format) #define WARN_TAINT(condition, taint, format...) WARN(condition, format) #define WARN_TAINT_ONCE(condition, taint, format...) WARN(condition, format) #endif # 199 "./include/asm-generic/bug.h" /* * WARN_ON_SMP() is for cases that the warning is either * meaningless for !SMP or may even cause failures. * This is usually used for cases that we have * WARN_ON(!spin_is_locked(&lock)) checks, as spin_is_locked() * returns 0 for uniprocessor settings. * It can also be used with values that are only defined * on SMP: * * struct foo { * [...] * #ifdef CONFIG_SMP * int bar; * #endif * }; * * void func(struct foo *zoot) * { * WARN_ON_SMP(!zoot->bar); * * For CONFIG_SMP, WARN_ON_SMP() should act the same as WARN_ON(), * and should be a nop and return false for uniprocessor. * * if (WARN_ON_SMP(x)) returns true only when CONFIG_SMP is set * and x is true. */ #ifdef CONFIG_SMP # define WARN_ON_SMP(x) WARN_ON(x) #else # 229 "./include/asm-generic/bug.h" /* * Use of ({0;}) because WARN_ON_SMP(x) may be used either as * a stand alone line statement or as a condition in an if () * statement. * A simple "0" would cause gcc to give a "statement has no effect" * warning. */ # define WARN_ON_SMP(x) ({0;}) #endif # 238 "./include/asm-generic/bug.h" #endif /* __ASSEMBLY__ */ # 240 "./include/asm-generic/bug.h" #endif # 242 "./include/asm-generic/bug.h" # 84 "./arch/x86/include/asm/bug.h" 2 #endif /* _ASM_X86_BUG_H */ # 86 "./arch/x86/include/asm/bug.h" # 6 "./include/linux/bug.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./include/linux/bug.h" # 7 "./include/linux/bug.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 7 "./include/linux/bug.h" # 8 "./include/linux/bug.h" enum bug_trap_type { BUG_TRAP_TYPE_NONE = 0, BUG_TRAP_TYPE_WARN = 1, BUG_TRAP_TYPE_BUG = 2, }; struct pt_regs; #ifdef __CHECKER__ #define MAYBE_BUILD_BUG_ON(cond) (0) #else /* __CHECKER__ */ # 20 "./include/linux/bug.h" #define MAYBE_BUILD_BUG_ON(cond) \ do { \ if (__builtin_constant_p((cond))) \ BUILD_BUG_ON(cond); \ else \ BUG_ON(cond); \ } while (0) #endif /* __CHECKER__ */ # 30 "./include/linux/bug.h" #ifdef CONFIG_GENERIC_BUG #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "./include/linux/bug.h" # 33 "./include/linux/bug.h" static inline int is_warning_bug(const struct bug_entry *bug) { return bug->flags & BUGFLAG_WARNING; } struct bug_entry *find_bug(unsigned long bugaddr); enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs); /* These are defined by the architecture */ int is_valid_bugaddr(unsigned long addr); void generic_bug_clear_once(void); #else /* !CONFIG_GENERIC_BUG */ # 49 "./include/linux/bug.h" static inline enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs) { return BUG_TRAP_TYPE_BUG; } static inline void generic_bug_clear_once(void) {} #endif /* CONFIG_GENERIC_BUG */ # 60 "./include/linux/bug.h" /* * Since detected data corruption should stop operation on the affected * structures. Return value must be checked and sanely acted on by caller. */ static inline __must_check bool check_data_corruption(bool v) { return v; } #define CHECK_DATA_CORRUPTION(condition, fmt, ...) \ check_data_corruption(({ \ bool corruption = unlikely(condition); \ if (corruption) { \ if (IS_ENABLED(CONFIG_BUG_ON_DATA_CORRUPTION)) { \ pr_err(fmt, ##__VA_ARGS__); \ BUG(); \ } else \ WARN(1, fmt, ##__VA_ARGS__); \ } \ corruption; \ })) #endif /* _LINUX_BUG_H */ # 80 "./include/linux/bug.h" # 6 "./include/linux/mmdebug.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./include/linux/mmdebug.h" # 7 "./include/linux/mmdebug.h" struct page; struct vm_area_struct; struct mm_struct; extern void dump_page(struct page *page, const char *reason); extern void __dump_page(struct page *page, const char *reason); void dump_vma(const struct vm_area_struct *vma); void dump_mm(const struct mm_struct *mm); #ifdef CONFIG_DEBUG_VM #define VM_BUG_ON(cond) BUG_ON(cond) #define VM_BUG_ON_PAGE(cond, page) \ do { \ if (unlikely(cond)) { \ dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ BUG(); \ } \ } while (0) #define VM_BUG_ON_VMA(cond, vma) \ do { \ if (unlikely(cond)) { \ dump_vma(vma); \ BUG(); \ } \ } while (0) #define VM_BUG_ON_MM(cond, mm) \ do { \ if (unlikely(cond)) { \ dump_mm(mm); \ BUG(); \ } \ } while (0) #define VM_WARN_ON(cond) WARN_ON(cond) #define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond) #define VM_WARN_ONCE(cond, format...) WARN_ONCE(cond, format) #define VM_WARN(cond, format...) WARN(cond, format) #else # 45 "./include/linux/mmdebug.h" #define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond) #define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond) #define VM_BUG_ON_VMA(cond, vma) VM_BUG_ON(cond) #define VM_BUG_ON_MM(cond, mm) VM_BUG_ON(cond) #define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond) #define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond) #define VM_WARN_ONCE(cond, format...) BUILD_BUG_ON_INVALID(cond) #define VM_WARN(cond, format...) BUILD_BUG_ON_INVALID(cond) #endif # 54 "./include/linux/mmdebug.h" #ifdef CONFIG_DEBUG_VIRTUAL #define VIRTUAL_BUG_ON(cond) BUG_ON(cond) #else # 58 "./include/linux/mmdebug.h" #define VIRTUAL_BUG_ON(cond) do { } while (0) #endif # 60 "./include/linux/mmdebug.h" #ifdef CONFIG_DEBUG_VM_PGFLAGS #define VM_BUG_ON_PGFLAGS(cond, page) VM_BUG_ON_PAGE(cond, page) #else # 64 "./include/linux/mmdebug.h" #define VM_BUG_ON_PGFLAGS(cond, page) BUILD_BUG_ON_INVALID(cond) #endif # 66 "./include/linux/mmdebug.h" #endif # 68 "./include/linux/mmdebug.h" # 6 "./include/linux/gfp.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./include/linux/gfp.h" # 1 "./include/linux/mmzone.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_MMZONE_H #define _LINUX_MMZONE_H #ifndef __ASSEMBLY__ #ifndef __GENERATING_BOUNDS_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 8 "./include/linux/mmzone.h" # 1 "./include/linux/spinlock.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __LINUX_SPINLOCK_H #define __LINUX_SPINLOCK_H /* * include/linux/spinlock.h - generic spinlock/rwlock declarations * * here's the role of the various spinlock/rwlock related include files: * * on SMP builds: * * asm/spinlock_types.h: contains the arch_spinlock_t/arch_rwlock_t and the * initializers * * linux/spinlock_types.h: * defines the generic type and initializers * * asm/spinlock.h: contains the arch_spin_*()/etc. lowlevel * implementations, mostly inline assembly code * * (also included on UP-debug builds:) * * linux/spinlock_api_smp.h: * contains the prototypes for the _spin_*() APIs. * * linux/spinlock.h: builds the final spin_*() APIs. * * on UP builds: * * linux/spinlock_type_up.h: * contains the generic, simplified UP spinlock type. * (which is an empty structure on non-debug builds) * * linux/spinlock_types.h: * defines the generic type and initializers * * linux/spinlock_up.h: * contains the arch_spin_*()/etc. version of UP * builds. (which are NOPs on non-debug, non-preempt * builds) * * (included on UP-non-debug builds:) * * linux/spinlock_api_up.h: * builds the _spin_*() APIs. * * linux/spinlock.h: builds the final spin_*() APIs. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 50 "./include/linux/spinlock.h" # 51 "./include/linux/spinlock.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 51 "./include/linux/spinlock.h" # 1 "./include/linux/preempt.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __LINUX_PREEMPT_H #define __LINUX_PREEMPT_H /* * include/linux/preempt.h - macros for accessing and manipulating * preempt_count (used for kernel preemption, interrupt count, etc.) */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 10 "./include/linux/preempt.h" # 11 "./include/linux/preempt.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 11 "./include/linux/preempt.h" # 1 "./include/linux/list.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_LIST_H #define _LINUX_LIST_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/linux/list.h" # 6 "./include/linux/list.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./include/linux/list.h" # 7 "./include/linux/list.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 7 "./include/linux/list.h" # 1 "./include/linux/poison.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_POISON_H #define _LINUX_POISON_H /********** include/linux/list.h **********/ /* * Architectures might want to move the poison pointer offset * into some well-recognized area such as 0xdead000000000000, * that is also not mappable by user-space exploits: */ #ifdef CONFIG_ILLEGAL_POINTER_VALUE # define POISON_POINTER_DELTA _AC(CONFIG_ILLEGAL_POINTER_VALUE, UL) #else # 15 "./include/linux/poison.h" # define POISON_POINTER_DELTA 0 #endif # 17 "./include/linux/poison.h" /* * These are non-NULL pointers that will result in page faults * under normal circumstances, used to verify that nobody uses * non-initialized list entries. */ #define LIST_POISON1 ((void *) 0x100 + POISON_POINTER_DELTA) #define LIST_POISON2 ((void *) 0x200 + POISON_POINTER_DELTA) /********** include/linux/timer.h **********/ /* * Magic number "tsta" to indicate a static timer initializer * for the object debugging code. */ #define TIMER_ENTRY_STATIC ((void *) 0x300 + POISON_POINTER_DELTA) /********** mm/debug-pagealloc.c **********/ #ifdef CONFIG_PAGE_POISONING_ZERO #define PAGE_POISON 0x00 #else # 37 "./include/linux/poison.h" #define PAGE_POISON 0xaa #endif # 39 "./include/linux/poison.h" /********** mm/page_alloc.c ************/ #define TAIL_MAPPING ((void *) 0x400 + POISON_POINTER_DELTA) /********** mm/slab.c **********/ /* * Magic nums for obj red zoning. * Placed in the first word before and the first word after an obj. */ #define RED_INACTIVE 0x09F911029D74E35BULL /* when obj is inactive */ #define RED_ACTIVE 0xD84156C5635688C0ULL /* when obj is active */ #define SLUB_RED_INACTIVE 0xbb #define SLUB_RED_ACTIVE 0xcc /* ...and for poisoning */ #define POISON_INUSE 0x5a /* for use-uninitialised poisoning */ #define POISON_FREE 0x6b /* for use-after-free poisoning */ #define POISON_END 0xa5 /* end-byte of poisoning */ /********** arch/$ARCH/mm/init.c **********/ #define POISON_FREE_INITMEM 0xcc /********** arch/ia64/hp/common/sba_iommu.c **********/ /* * arch/ia64/hp/common/sba_iommu.c uses a 16-byte poison string with a * value of "SBAIOMMU POISON\0" for spill-over poisoning. */ /********** fs/jbd/journal.c **********/ #define JBD_POISON_FREE 0x5b #define JBD2_POISON_FREE 0x5c /********** drivers/base/dmapool.c **********/ #define POOL_POISON_FREED 0xa7 /* !inuse */ #define POOL_POISON_ALLOCATED 0xa9 /* !initted */ /********** drivers/atm/ **********/ #define ATM_POISON_FREE 0x12 #define ATM_POISON 0xdeadbeef /********** kernel/mutexes **********/ #define MUTEX_DEBUG_INIT 0x11 #define MUTEX_DEBUG_FREE 0x22 #define MUTEX_POISON_WW_CTX ((void *) 0x500 + POISON_POINTER_DELTA) /********** lib/flex_array.c **********/ #define FLEX_ARRAY_FREE 0x6c /* for use-after-free poisoning */ /********** security/ **********/ #define KEY_DESTROY 0xbd #endif # 93 "./include/linux/poison.h" # 8 "./include/linux/list.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 8 "./include/linux/list.h" # 1 "./include/uapi/linux/const.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* const.h: Macros for dealing with constants. */ #ifndef _LINUX_CONST_H #define _LINUX_CONST_H /* Some constant macros are used in both assembler and * C code. Therefore we cannot annotate them always with * 'UL' and other type specifiers unilaterally. We * use the following macros to deal with this. * * Similarly, _AT() will cast an expression with a type in C, but * leave it unchanged in asm. */ #ifdef __ASSEMBLY__ #define _AC(X,Y) X #define _AT(T,X) X #else # 20 "./include/uapi/linux/const.h" #define __AC(X,Y) (X##Y) #define _AC(X,Y) __AC(X,Y) #define _AT(T,X) ((T)(X)) #endif # 24 "./include/uapi/linux/const.h" #define _BITUL(x) (_AC(1,UL) << (x)) #define _BITULL(x) (_AC(1,ULL) << (x)) #endif /* !(_LINUX_CONST_H) */ # 29 "./include/uapi/linux/const.h" # 9 "./include/linux/list.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 9 "./include/linux/list.h" # 10 "./include/linux/list.h" /* * Simple doubly linked list implementation. * * Some of the internal functions ("__xxx") are useful when * manipulating whole lists rather than single entries, as * sometimes we already know the next/prev entries and we can * generate better code by using them directly rather than * using the generic single-entry routines. */ #define LIST_HEAD_INIT(name) { &(name), &(name) } #define LIST_HEAD(name) \ struct list_head name = LIST_HEAD_INIT(name) static inline void INIT_LIST_HEAD(struct list_head *list) { WRITE_ONCE(list->next, list); list->prev = list; } #ifdef CONFIG_DEBUG_LIST extern bool __list_add_valid(struct list_head *new, struct list_head *prev, struct list_head *next); extern bool __list_del_entry_valid(struct list_head *entry); #else # 38 "./include/linux/list.h" static inline bool __list_add_valid(struct list_head *new, struct list_head *prev, struct list_head *next) { return true; } static inline bool __list_del_entry_valid(struct list_head *entry) { return true; } #endif # 49 "./include/linux/list.h" /* * Insert a new entry between two known consecutive entries. * * This is only for internal list manipulation where we know * the prev/next entries already! */ static inline void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next) { if (!__list_add_valid(new, prev, next)) return; next->prev = new; new->next = next; new->prev = prev; WRITE_ONCE(prev->next, new); } /** * list_add - add a new entry * @new: new entry to be added * @head: list head to add it after * * Insert a new entry after the specified head. * This is good for implementing stacks. */ static inline void list_add(struct list_head *new, struct list_head *head) { __list_add(new, head, head->next); } /** * list_add_tail - add a new entry * @new: new entry to be added * @head: list head to add it before * * Insert a new entry before the specified head. * This is useful for implementing queues. */ static inline void list_add_tail(struct list_head *new, struct list_head *head) { __list_add(new, head->prev, head); } /* * Delete a list entry by making the prev/next entries * point to each other. * * This is only for internal list manipulation where we know * the prev/next entries already! */ static inline void __list_del(struct list_head * prev, struct list_head * next) { next->prev = prev; WRITE_ONCE(prev->next, next); } /** * list_del - deletes entry from list. * @entry: the element to delete from the list. * Note: list_empty() on entry does not return true after this, the entry is * in an undefined state. */ static inline void __list_del_entry(struct list_head *entry) { if (!__list_del_entry_valid(entry)) return; __list_del(entry->prev, entry->next); } static inline void list_del(struct list_head *entry) { __list_del_entry(entry); entry->next = LIST_POISON1; entry->prev = LIST_POISON2; } /** * list_replace - replace old entry by new one * @old : the element to be replaced * @new : the new element to insert * * If @old was empty, it will be overwritten. */ static inline void list_replace(struct list_head *old, struct list_head *new) { new->next = old->next; new->next->prev = new; new->prev = old->prev; new->prev->next = new; } static inline void list_replace_init(struct list_head *old, struct list_head *new) { list_replace(old, new); INIT_LIST_HEAD(old); } /** * list_del_init - deletes entry from list and reinitialize it. * @entry: the element to delete from the list. */ static inline void list_del_init(struct list_head *entry) { __list_del_entry(entry); INIT_LIST_HEAD(entry); } /** * list_move - delete from one list and add as another's head * @list: the entry to move * @head: the head that will precede our entry */ static inline void list_move(struct list_head *list, struct list_head *head) { __list_del_entry(list); list_add(list, head); } /** * list_move_tail - delete from one list and add as another's tail * @list: the entry to move * @head: the head that will follow our entry */ static inline void list_move_tail(struct list_head *list, struct list_head *head) { __list_del_entry(list); list_add_tail(list, head); } /** * list_is_last - tests whether @list is the last entry in list @head * @list: the entry to test * @head: the head of the list */ static inline int list_is_last(const struct list_head *list, const struct list_head *head) { return list->next == head; } /** * list_empty - tests whether a list is empty * @head: the list to test. */ static inline int list_empty(const struct list_head *head) { return READ_ONCE(head->next) == head; } /** * list_empty_careful - tests whether a list is empty and not being modified * @head: the list to test * * Description: * tests whether a list is empty _and_ checks that no other CPU might be * in the process of modifying either member (next or prev) * * NOTE: using list_empty_careful() without synchronization * can only be safe if the only activity that can happen * to the list entry is list_del_init(). Eg. it cannot be used * if another CPU could re-list_add() it. */ static inline int list_empty_careful(const struct list_head *head) { struct list_head *next = head->next; return (next == head) && (next == head->prev); } /** * list_rotate_left - rotate the list to the left * @head: the head of the list */ static inline void list_rotate_left(struct list_head *head) { struct list_head *first; if (!list_empty(head)) { first = head->next; list_move_tail(first, head); } } /** * list_is_singular - tests whether a list has just one entry. * @head: the list to test. */ static inline int list_is_singular(const struct list_head *head) { return !list_empty(head) && (head->next == head->prev); } static inline void __list_cut_position(struct list_head *list, struct list_head *head, struct list_head *entry) { struct list_head *new_first = entry->next; list->next = head->next; list->next->prev = list; list->prev = entry; entry->next = list; head->next = new_first; new_first->prev = head; } /** * list_cut_position - cut a list into two * @list: a new list to add all removed entries * @head: a list with entries * @entry: an entry within head, could be the head itself * and if so we won't cut the list * * This helper moves the initial part of @head, up to and * including @entry, from @head to @list. You should * pass on @entry an element you know is on @head. @list * should be an empty list or a list you do not care about * losing its data. * */ static inline void list_cut_position(struct list_head *list, struct list_head *head, struct list_head *entry) { if (list_empty(head)) return; if (list_is_singular(head) && (head->next != entry && head != entry)) return; if (entry == head) INIT_LIST_HEAD(list); else __list_cut_position(list, head, entry); } static inline void __list_splice(const struct list_head *list, struct list_head *prev, struct list_head *next) { struct list_head *first = list->next; struct list_head *last = list->prev; first->prev = prev; prev->next = first; last->next = next; next->prev = last; } /** * list_splice - join two lists, this is designed for stacks * @list: the new list to add. * @head: the place to add it in the first list. */ static inline void list_splice(const struct list_head *list, struct list_head *head) { if (!list_empty(list)) __list_splice(list, head, head->next); } /** * list_splice_tail - join two lists, each list being a queue * @list: the new list to add. * @head: the place to add it in the first list. */ static inline void list_splice_tail(struct list_head *list, struct list_head *head) { if (!list_empty(list)) __list_splice(list, head->prev, head); } /** * list_splice_init - join two lists and reinitialise the emptied list. * @list: the new list to add. * @head: the place to add it in the first list. * * The list at @list is reinitialised */ static inline void list_splice_init(struct list_head *list, struct list_head *head) { if (!list_empty(list)) { __list_splice(list, head, head->next); INIT_LIST_HEAD(list); } } /** * list_splice_tail_init - join two lists and reinitialise the emptied list * @list: the new list to add. * @head: the place to add it in the first list. * * Each of the lists is a queue. * The list at @list is reinitialised */ static inline void list_splice_tail_init(struct list_head *list, struct list_head *head) { if (!list_empty(list)) { __list_splice(list, head->prev, head); INIT_LIST_HEAD(list); } } /** * list_entry - get the struct for this entry * @ptr: the &struct list_head pointer. * @type: the type of the struct this is embedded in. * @member: the name of the list_head within the struct. */ #define list_entry(ptr, type, member) \ container_of(ptr, type, member) /** * list_first_entry - get the first element from a list * @ptr: the list head to take the element from. * @type: the type of the struct this is embedded in. * @member: the name of the list_head within the struct. * * Note, that list is expected to be not empty. */ #define list_first_entry(ptr, type, member) \ list_entry((ptr)->next, type, member) /** * list_last_entry - get the last element from a list * @ptr: the list head to take the element from. * @type: the type of the struct this is embedded in. * @member: the name of the list_head within the struct. * * Note, that list is expected to be not empty. */ #define list_last_entry(ptr, type, member) \ list_entry((ptr)->prev, type, member) /** * list_first_entry_or_null - get the first element from a list * @ptr: the list head to take the element from. * @type: the type of the struct this is embedded in. * @member: the name of the list_head within the struct. * * Note that if the list is empty, it returns NULL. */ #define list_first_entry_or_null(ptr, type, member) ({ \ struct list_head *head__ = (ptr); \ struct list_head *pos__ = READ_ONCE(head__->next); \ pos__ != head__ ? list_entry(pos__, type, member) : NULL; \ }) /** * list_next_entry - get the next element in list * @pos: the type * to cursor * @member: the name of the list_head within the struct. */ #define list_next_entry(pos, member) \ list_entry((pos)->member.next, typeof(*(pos)), member) /** * list_prev_entry - get the prev element in list * @pos: the type * to cursor * @member: the name of the list_head within the struct. */ #define list_prev_entry(pos, member) \ list_entry((pos)->member.prev, typeof(*(pos)), member) /** * list_for_each - iterate over a list * @pos: the &struct list_head to use as a loop cursor. * @head: the head for your list. */ #define list_for_each(pos, head) \ for (pos = (head)->next; pos != (head); pos = pos->next) /** * list_for_each_prev - iterate over a list backwards * @pos: the &struct list_head to use as a loop cursor. * @head: the head for your list. */ #define list_for_each_prev(pos, head) \ for (pos = (head)->prev; pos != (head); pos = pos->prev) /** * list_for_each_safe - iterate over a list safe against removal of list entry * @pos: the &struct list_head to use as a loop cursor. * @n: another &struct list_head to use as temporary storage * @head: the head for your list. */ #define list_for_each_safe(pos, n, head) \ for (pos = (head)->next, n = pos->next; pos != (head); \ pos = n, n = pos->next) /** * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry * @pos: the &struct list_head to use as a loop cursor. * @n: another &struct list_head to use as temporary storage * @head: the head for your list. */ #define list_for_each_prev_safe(pos, n, head) \ for (pos = (head)->prev, n = pos->prev; \ pos != (head); \ pos = n, n = pos->prev) /** * list_for_each_entry - iterate over list of given type * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_head within the struct. */ #define list_for_each_entry(pos, head, member) \ for (pos = list_first_entry(head, typeof(*pos), member); \ &pos->member != (head); \ pos = list_next_entry(pos, member)) /** * list_for_each_entry_reverse - iterate backwards over list of given type. * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_head within the struct. */ #define list_for_each_entry_reverse(pos, head, member) \ for (pos = list_last_entry(head, typeof(*pos), member); \ &pos->member != (head); \ pos = list_prev_entry(pos, member)) /** * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue() * @pos: the type * to use as a start point * @head: the head of the list * @member: the name of the list_head within the struct. * * Prepares a pos entry for use as a start point in list_for_each_entry_continue(). */ #define list_prepare_entry(pos, head, member) \ ((pos) ? : list_entry(head, typeof(*pos), member)) /** * list_for_each_entry_continue - continue iteration over list of given type * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_head within the struct. * * Continue to iterate over list of given type, continuing after * the current position. */ #define list_for_each_entry_continue(pos, head, member) \ for (pos = list_next_entry(pos, member); \ &pos->member != (head); \ pos = list_next_entry(pos, member)) /** * list_for_each_entry_continue_reverse - iterate backwards from the given point * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_head within the struct. * * Start to iterate over list of given type backwards, continuing after * the current position. */ #define list_for_each_entry_continue_reverse(pos, head, member) \ for (pos = list_prev_entry(pos, member); \ &pos->member != (head); \ pos = list_prev_entry(pos, member)) /** * list_for_each_entry_from - iterate over list of given type from the current point * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_head within the struct. * * Iterate over list of given type, continuing from current position. */ #define list_for_each_entry_from(pos, head, member) \ for (; &pos->member != (head); \ pos = list_next_entry(pos, member)) /** * list_for_each_entry_from_reverse - iterate backwards over list of given type * from the current point * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_head within the struct. * * Iterate backwards over list of given type, continuing from current position. */ #define list_for_each_entry_from_reverse(pos, head, member) \ for (; &pos->member != (head); \ pos = list_prev_entry(pos, member)) /** * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. * @member: the name of the list_head within the struct. */ #define list_for_each_entry_safe(pos, n, head, member) \ for (pos = list_first_entry(head, typeof(*pos), member), \ n = list_next_entry(pos, member); \ &pos->member != (head); \ pos = n, n = list_next_entry(n, member)) /** * list_for_each_entry_safe_continue - continue list iteration safe against removal * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. * @member: the name of the list_head within the struct. * * Iterate over list of given type, continuing after current point, * safe against removal of list entry. */ #define list_for_each_entry_safe_continue(pos, n, head, member) \ for (pos = list_next_entry(pos, member), \ n = list_next_entry(pos, member); \ &pos->member != (head); \ pos = n, n = list_next_entry(n, member)) /** * list_for_each_entry_safe_from - iterate over list from current point safe against removal * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. * @member: the name of the list_head within the struct. * * Iterate over list of given type from current point, safe against * removal of list entry. */ #define list_for_each_entry_safe_from(pos, n, head, member) \ for (n = list_next_entry(pos, member); \ &pos->member != (head); \ pos = n, n = list_next_entry(n, member)) /** * list_for_each_entry_safe_reverse - iterate backwards over list safe against removal * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. * @member: the name of the list_head within the struct. * * Iterate backwards over list of given type, safe against removal * of list entry. */ #define list_for_each_entry_safe_reverse(pos, n, head, member) \ for (pos = list_last_entry(head, typeof(*pos), member), \ n = list_prev_entry(pos, member); \ &pos->member != (head); \ pos = n, n = list_prev_entry(n, member)) /** * list_safe_reset_next - reset a stale list_for_each_entry_safe loop * @pos: the loop cursor used in the list_for_each_entry_safe loop * @n: temporary storage used in list_for_each_entry_safe * @member: the name of the list_head within the struct. * * list_safe_reset_next is not safe to use in general if the list may be * modified concurrently (eg. the lock is dropped in the loop body). An * exception to this is if the cursor element (pos) is pinned in the list, * and list_safe_reset_next is called after re-taking the lock and before * completing the current iteration of the loop body. */ #define list_safe_reset_next(pos, n, member) \ n = list_next_entry(pos, member) /* * Double linked lists with a single pointer list head. * Mostly useful for hash tables where the two pointer list head is * too wasteful. * You lose the ability to access the tail in O(1). */ #define HLIST_HEAD_INIT { .first = NULL } #define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } #define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) static inline void INIT_HLIST_NODE(struct hlist_node *h) { h->next = NULL; h->pprev = NULL; } static inline int hlist_unhashed(const struct hlist_node *h) { return !h->pprev; } static inline int hlist_empty(const struct hlist_head *h) { return !READ_ONCE(h->first); } static inline void __hlist_del(struct hlist_node *n) { struct hlist_node *next = n->next; struct hlist_node **pprev = n->pprev; WRITE_ONCE(*pprev, next); if (next) next->pprev = pprev; } static inline void hlist_del(struct hlist_node *n) { __hlist_del(n); n->next = LIST_POISON1; n->pprev = LIST_POISON2; } static inline void hlist_del_init(struct hlist_node *n) { if (!hlist_unhashed(n)) { __hlist_del(n); INIT_HLIST_NODE(n); } } static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) { struct hlist_node *first = h->first; n->next = first; if (first) first->pprev = &n->next; WRITE_ONCE(h->first, n); n->pprev = &h->first; } /* next must be != NULL */ static inline void hlist_add_before(struct hlist_node *n, struct hlist_node *next) { n->pprev = next->pprev; n->next = next; next->pprev = &n->next; WRITE_ONCE(*(n->pprev), n); } static inline void hlist_add_behind(struct hlist_node *n, struct hlist_node *prev) { n->next = prev->next; WRITE_ONCE(prev->next, n); n->pprev = &prev->next; if (n->next) n->next->pprev = &n->next; } /* after that we'll appear to be on some hlist and hlist_del will work */ static inline void hlist_add_fake(struct hlist_node *n) { n->pprev = &n->next; } static inline bool hlist_fake(struct hlist_node *h) { return h->pprev == &h->next; } /* * Check whether the node is the only node of the head without * accessing head: */ static inline bool hlist_is_singular_node(struct hlist_node *n, struct hlist_head *h) { return !n->next && n->pprev == &h->first; } /* * Move a list from one list head to another. Fixup the pprev * reference of the first entry if it exists. */ static inline void hlist_move_list(struct hlist_head *old, struct hlist_head *new) { new->first = old->first; if (new->first) new->first->pprev = &new->first; old->first = NULL; } #define hlist_entry(ptr, type, member) container_of(ptr,type,member) #define hlist_for_each(pos, head) \ for (pos = (head)->first; pos ; pos = pos->next) #define hlist_for_each_safe(pos, n, head) \ for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ pos = n) #define hlist_entry_safe(ptr, type, member) \ ({ typeof(ptr) ____ptr = (ptr); \ ____ptr ? hlist_entry(____ptr, type, member) : NULL; \ }) /** * hlist_for_each_entry - iterate over list of given type * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the hlist_node within the struct. */ #define hlist_for_each_entry(pos, head, member) \ for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\ pos; \ pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) /** * hlist_for_each_entry_continue - iterate over a hlist continuing after current point * @pos: the type * to use as a loop cursor. * @member: the name of the hlist_node within the struct. */ #define hlist_for_each_entry_continue(pos, member) \ for (pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member);\ pos; \ pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) /** * hlist_for_each_entry_from - iterate over a hlist continuing from current point * @pos: the type * to use as a loop cursor. * @member: the name of the hlist_node within the struct. */ #define hlist_for_each_entry_from(pos, member) \ for (; pos; \ pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) /** * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry * @pos: the type * to use as a loop cursor. * @n: another &struct hlist_node to use as temporary storage * @head: the head for your list. * @member: the name of the hlist_node within the struct. */ #define hlist_for_each_entry_safe(pos, n, head, member) \ for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\ pos && ({ n = pos->member.next; 1; }); \ pos = hlist_entry_safe(n, typeof(*pos), member)) #endif # 791 "./include/linux/list.h" # 12 "./include/linux/preempt.h" 2 /* * We put the hardirq and softirq counter into the preemption * counter. The bitmask has the following meaning: * * - bits 0-7 are the preemption count (max preemption depth: 256) * - bits 8-15 are the softirq count (max # of softirqs: 256) * * The hardirq count could in theory be the same as the number of * interrupts in the system, but we run all interrupt handlers with * interrupts disabled, so we cannot have nesting interrupts. Though * there are a few palaeontologic drivers which reenable interrupts in * the handler, so we need more than one bit here. * * PREEMPT_MASK: 0x000000ff * SOFTIRQ_MASK: 0x0000ff00 * HARDIRQ_MASK: 0x000f0000 * NMI_MASK: 0x00100000 * PREEMPT_NEED_RESCHED: 0x80000000 */ #define PREEMPT_BITS 8 #define SOFTIRQ_BITS 8 #define HARDIRQ_BITS 4 #define NMI_BITS 1 #define PREEMPT_SHIFT 0 #define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) #define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) #define NMI_SHIFT (HARDIRQ_SHIFT + HARDIRQ_BITS) #define __IRQ_MASK(x) ((1UL << (x))-1) #define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT) #define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) #define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT) #define NMI_MASK (__IRQ_MASK(NMI_BITS) << NMI_SHIFT) #define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT) #define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) #define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) #define NMI_OFFSET (1UL << NMI_SHIFT) #define SOFTIRQ_DISABLE_OFFSET (2 * SOFTIRQ_OFFSET) /* We use the MSB mostly because its available */ #define PREEMPT_NEED_RESCHED 0x80000000 #define PREEMPT_DISABLED (PREEMPT_DISABLE_OFFSET + PREEMPT_ENABLED) /* * Disable preemption until the scheduler is running -- use an unconditional * value so that it also works on !PREEMPT_COUNT kernels. * * Reset by start_kernel()->sched_init()->init_idle()->init_idle_preempt_count(). */ #define INIT_PREEMPT_COUNT PREEMPT_OFFSET /* * Initial preempt_count value; reflects the preempt_count schedule invariant * which states that during context switches: * * preempt_count() == 2*PREEMPT_DISABLE_OFFSET * * Note: PREEMPT_DISABLE_OFFSET is 0 for !PREEMPT_COUNT kernels. * Note: See finish_task_switch(). */ #define FORK_PREEMPT_COUNT (2*PREEMPT_DISABLE_OFFSET + PREEMPT_ENABLED) /* preempt_count() and related functions, depends on PREEMPT_NEED_RESCHED */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 81 "./include/linux/preempt.h" # 1 "./arch/x86/include/asm/preempt.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __ASM_PREEMPT_H #define __ASM_PREEMPT_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./arch/x86/include/asm/preempt.h" # 6 "./arch/x86/include/asm/preempt.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./arch/x86/include/asm/preempt.h" # 1 "./arch/x86/include/asm/percpu.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_PERCPU_H #define _ASM_X86_PERCPU_H #ifdef CONFIG_X86_64 #define __percpu_seg gs #define __percpu_mov_op movq #else # 9 "./arch/x86/include/asm/percpu.h" #define __percpu_seg fs #define __percpu_mov_op movl #endif # 12 "./arch/x86/include/asm/percpu.h" #ifdef __ASSEMBLY__ /* * PER_CPU finds an address of a per-cpu variable. * * Args: * var - variable name * reg - 32bit register * * The resulting address is stored in the "reg" argument. * * Example: * PER_CPU(cpu_gdt_descr, %ebx) */ #ifdef CONFIG_SMP #define PER_CPU(var, reg) \ __percpu_mov_op %__percpu_seg:this_cpu_off, reg; \ lea var(reg), reg #define PER_CPU_VAR(var) %__percpu_seg:var #else /* ! SMP */ # 33 "./arch/x86/include/asm/percpu.h" #define PER_CPU(var, reg) __percpu_mov_op $var, reg #define PER_CPU_VAR(var) var #endif /* SMP */ # 36 "./arch/x86/include/asm/percpu.h" #ifdef CONFIG_X86_64_SMP #define INIT_PER_CPU_VAR(var) init_per_cpu__##var #else # 40 "./arch/x86/include/asm/percpu.h" #define INIT_PER_CPU_VAR(var) var #endif # 42 "./arch/x86/include/asm/percpu.h" #else /* ...!ASSEMBLY */ # 44 "./arch/x86/include/asm/percpu.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 45 "./arch/x86/include/asm/percpu.h" # 46 "./arch/x86/include/asm/percpu.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 46 "./arch/x86/include/asm/percpu.h" # 47 "./arch/x86/include/asm/percpu.h" #ifdef CONFIG_SMP #define __percpu_prefix "%%"__stringify(__percpu_seg)":" #define __my_cpu_offset this_cpu_read(this_cpu_off) /* * Compared to the generic __my_cpu_offset version, the following * saves one instruction and avoids clobbering a temp register. */ #define arch_raw_cpu_ptr(ptr) \ ({ \ unsigned long tcp_ptr__; \ asm volatile("add " __percpu_arg(1) ", %0" \ : "=r" (tcp_ptr__) \ : "m" (this_cpu_off), "0" (ptr)); \ (typeof(*(ptr)) __kernel __force *)tcp_ptr__; \ }) #else # 65 "./arch/x86/include/asm/percpu.h" #define __percpu_prefix "" #endif # 67 "./arch/x86/include/asm/percpu.h" #define __percpu_arg(x) __percpu_prefix "%" #x /* * Initialized pointers to per-cpu variables needed for the boot * processor need to use these macros to get the proper address * offset from __per_cpu_load on SMP. * * There also must be an entry in vmlinux_64.lds.S */ #define DECLARE_INIT_PER_CPU(var) \ extern typeof(var) init_per_cpu_var(var) #ifdef CONFIG_X86_64_SMP #define init_per_cpu_var(var) init_per_cpu__##var #else # 83 "./arch/x86/include/asm/percpu.h" #define init_per_cpu_var(var) var #endif # 85 "./arch/x86/include/asm/percpu.h" /* For arch-specific code, we can use direct single-insn ops (they * don't give an lvalue though). */ extern void __bad_percpu_size(void); #define percpu_to_op(op, var, val) \ do { \ typedef typeof(var) pto_T__; \ if (0) { \ pto_T__ pto_tmp__; \ pto_tmp__ = (val); \ (void)pto_tmp__; \ } \ switch (sizeof(var)) { \ case 1: \ asm(op "b %1,"__percpu_arg(0) \ : "+m" (var) \ : "qi" ((unsigned char)(unsigned long)(val))); \ break; \ case 2: \ asm(op "w %1,"__percpu_arg(0) \ : "+m" (var) \ : "ri" ((pto_T__)(val))); \ break; \ case 4: \ asm(op "l %1,"__percpu_arg(0) \ : "+m" (var) \ : "ri" ((pto_T__)(val))); \ break; \ case 8: \ asm(op "q %1,"__percpu_arg(0) \ : "+m" (var) \ : "re" ((pto_T__)(val))); \ break; \ default: __bad_percpu_size(); \ } \ } while (0) /* * Generate a percpu add to memory instruction and optimize code * if one is added or subtracted. */ #define percpu_add_op(var, val) \ do { \ typedef typeof(var) pao_T__; \ const int pao_ID__ = (__builtin_constant_p(val) && \ ((val) == 1 || (val) == -1)) ? \ (int)(val) : 0; \ if (0) { \ pao_T__ pao_tmp__; \ pao_tmp__ = (val); \ (void)pao_tmp__; \ } \ switch (sizeof(var)) { \ case 1: \ if (pao_ID__ == 1) \ asm("incb "__percpu_arg(0) : "+m" (var)); \ else if (pao_ID__ == -1) \ asm("decb "__percpu_arg(0) : "+m" (var)); \ else \ asm("addb %1, "__percpu_arg(0) \ : "+m" (var) \ : "qi" ((unsigned char)(unsigned long)(val))); \ break; \ case 2: \ if (pao_ID__ == 1) \ asm("incw "__percpu_arg(0) : "+m" (var)); \ else if (pao_ID__ == -1) \ asm("decw "__percpu_arg(0) : "+m" (var)); \ else \ asm("addw %1, "__percpu_arg(0) \ : "+m" (var) \ : "ri" ((pao_T__)(val))); \ break; \ case 4: \ if (pao_ID__ == 1) \ asm("incl "__percpu_arg(0) : "+m" (var)); \ else if (pao_ID__ == -1) \ asm("decl "__percpu_arg(0) : "+m" (var)); \ else \ asm("addl %1, "__percpu_arg(0) \ : "+m" (var) \ : "ri" ((pao_T__)(val))); \ break; \ case 8: \ if (pao_ID__ == 1) \ asm("incq "__percpu_arg(0) : "+m" (var)); \ else if (pao_ID__ == -1) \ asm("decq "__percpu_arg(0) : "+m" (var)); \ else \ asm("addq %1, "__percpu_arg(0) \ : "+m" (var) \ : "re" ((pao_T__)(val))); \ break; \ default: __bad_percpu_size(); \ } \ } while (0) #define percpu_from_op(op, var) \ ({ \ unsigned char pfo_u8__; \ typeof(var) pfo_ret__; \ switch (sizeof(var)) { \ case 1: \ asm(op "b "__percpu_arg(1)",%0" \ : "=q" (pfo_u8__) \ : "m" (var)); \ pfo_ret__ = (typeof(var))(unsigned long)pfo_u8__; \ break; \ case 2: \ asm(op "w "__percpu_arg(1)",%0" \ : "=r" (pfo_ret__) \ : "m" (var)); \ break; \ case 4: \ asm(op "l "__percpu_arg(1)",%0" \ : "=r" (pfo_ret__) \ : "m" (var)); \ break; \ case 8: \ asm(op "q "__percpu_arg(1)",%0" \ : "=r" (pfo_ret__) \ : "m" (var)); \ break; \ default: __bad_percpu_size(); \ } \ pfo_ret__; \ }) #define percpu_stable_op(op, var) \ ({ \ unsigned char pfo_u8__; \ typeof(var) pfo_ret__; \ switch (sizeof(var)) { \ case 1: \ asm(op "b "__percpu_arg(P1)",%0" \ : "=q" (pfo_u8__) \ : "p" (&(var))); \ pfo_ret__ = (typeof(var))(unsigned long)pfo_u8__; \ break; \ case 2: \ asm(op "w "__percpu_arg(P1)",%0" \ : "=r" (pfo_ret__) \ : "p" (&(var))); \ break; \ case 4: \ asm(op "l "__percpu_arg(P1)",%0" \ : "=r" (pfo_ret__) \ : "p" (&(var))); \ break; \ case 8: \ asm(op "q "__percpu_arg(P1)",%0" \ : "=r" (pfo_ret__) \ : "p" (&(var))); \ break; \ default: __bad_percpu_size(); \ } \ pfo_ret__; \ }) #define percpu_unary_op(op, var) \ ({ \ switch (sizeof(var)) { \ case 1: \ asm(op "b "__percpu_arg(0) \ : "+m" (var)); \ break; \ case 2: \ asm(op "w "__percpu_arg(0) \ : "+m" (var)); \ break; \ case 4: \ asm(op "l "__percpu_arg(0) \ : "+m" (var)); \ break; \ case 8: \ asm(op "q "__percpu_arg(0) \ : "+m" (var)); \ break; \ default: __bad_percpu_size(); \ } \ }) /* * Add return operation */ #define percpu_add_return_op(var, val) \ ({ \ typeof(var) paro_ret__ = val; \ switch (sizeof(var)) { \ case 1: \ asm("xaddb %0, "__percpu_arg(1) \ : "+q" (paro_ret__), "+m" (var) \ : : "memory"); \ break; \ case 2: \ asm("xaddw %0, "__percpu_arg(1) \ : "+r" (paro_ret__), "+m" (var) \ : : "memory"); \ break; \ case 4: \ asm("xaddl %0, "__percpu_arg(1) \ : "+r" (paro_ret__), "+m" (var) \ : : "memory"); \ break; \ case 8: \ asm("xaddq %0, "__percpu_arg(1) \ : "+re" (paro_ret__), "+m" (var) \ : : "memory"); \ break; \ default: __bad_percpu_size(); \ } \ paro_ret__ += val; \ paro_ret__; \ }) /* * xchg is implemented using cmpxchg without a lock prefix. xchg is * expensive due to the implied lock prefix. The processor cannot prefetch * cachelines if xchg is used. */ #define percpu_xchg_op(var, nval) \ ({ \ typeof(var) pxo_ret__; \ typeof(var) pxo_new__ = (nval); \ switch (sizeof(var)) { \ case 1: \ asm("\n\tmov "__percpu_arg(1)",%%al" \ "\n1:\tcmpxchgb %2, "__percpu_arg(1) \ "\n\tjnz 1b" \ : "=&a" (pxo_ret__), "+m" (var) \ : "q" (pxo_new__) \ : "memory"); \ break; \ case 2: \ asm("\n\tmov "__percpu_arg(1)",%%ax" \ "\n1:\tcmpxchgw %2, "__percpu_arg(1) \ "\n\tjnz 1b" \ : "=&a" (pxo_ret__), "+m" (var) \ : "r" (pxo_new__) \ : "memory"); \ break; \ case 4: \ asm("\n\tmov "__percpu_arg(1)",%%eax" \ "\n1:\tcmpxchgl %2, "__percpu_arg(1) \ "\n\tjnz 1b" \ : "=&a" (pxo_ret__), "+m" (var) \ : "r" (pxo_new__) \ : "memory"); \ break; \ case 8: \ asm("\n\tmov "__percpu_arg(1)",%%rax" \ "\n1:\tcmpxchgq %2, "__percpu_arg(1) \ "\n\tjnz 1b" \ : "=&a" (pxo_ret__), "+m" (var) \ : "r" (pxo_new__) \ : "memory"); \ break; \ default: __bad_percpu_size(); \ } \ pxo_ret__; \ }) /* * cmpxchg has no such implied lock semantics as a result it is much * more efficient for cpu local operations. */ #define percpu_cmpxchg_op(var, oval, nval) \ ({ \ typeof(var) pco_ret__; \ typeof(var) pco_old__ = (oval); \ typeof(var) pco_new__ = (nval); \ switch (sizeof(var)) { \ case 1: \ asm("cmpxchgb %2, "__percpu_arg(1) \ : "=a" (pco_ret__), "+m" (var) \ : "q" (pco_new__), "0" (pco_old__) \ : "memory"); \ break; \ case 2: \ asm("cmpxchgw %2, "__percpu_arg(1) \ : "=a" (pco_ret__), "+m" (var) \ : "r" (pco_new__), "0" (pco_old__) \ : "memory"); \ break; \ case 4: \ asm("cmpxchgl %2, "__percpu_arg(1) \ : "=a" (pco_ret__), "+m" (var) \ : "r" (pco_new__), "0" (pco_old__) \ : "memory"); \ break; \ case 8: \ asm("cmpxchgq %2, "__percpu_arg(1) \ : "=a" (pco_ret__), "+m" (var) \ : "r" (pco_new__), "0" (pco_old__) \ : "memory"); \ break; \ default: __bad_percpu_size(); \ } \ pco_ret__; \ }) /* * this_cpu_read() makes gcc load the percpu variable every time it is * accessed while this_cpu_read_stable() allows the value to be cached. * this_cpu_read_stable() is more efficient and can be used if its value * is guaranteed to be valid across cpus. The current users include * get_current() and get_thread_info() both of which are actually * per-thread variables implemented as per-cpu variables and thus * stable for the duration of the respective task. */ #define this_cpu_read_stable(var) percpu_stable_op("mov", var) #define raw_cpu_read_1(pcp) percpu_from_op("mov", pcp) #define raw_cpu_read_2(pcp) percpu_from_op("mov", pcp) #define raw_cpu_read_4(pcp) percpu_from_op("mov", pcp) #define raw_cpu_write_1(pcp, val) percpu_to_op("mov", (pcp), val) #define raw_cpu_write_2(pcp, val) percpu_to_op("mov", (pcp), val) #define raw_cpu_write_4(pcp, val) percpu_to_op("mov", (pcp), val) #define raw_cpu_add_1(pcp, val) percpu_add_op((pcp), val) #define raw_cpu_add_2(pcp, val) percpu_add_op((pcp), val) #define raw_cpu_add_4(pcp, val) percpu_add_op((pcp), val) #define raw_cpu_and_1(pcp, val) percpu_to_op("and", (pcp), val) #define raw_cpu_and_2(pcp, val) percpu_to_op("and", (pcp), val) #define raw_cpu_and_4(pcp, val) percpu_to_op("and", (pcp), val) #define raw_cpu_or_1(pcp, val) percpu_to_op("or", (pcp), val) #define raw_cpu_or_2(pcp, val) percpu_to_op("or", (pcp), val) #define raw_cpu_or_4(pcp, val) percpu_to_op("or", (pcp), val) #define raw_cpu_xchg_1(pcp, val) percpu_xchg_op(pcp, val) #define raw_cpu_xchg_2(pcp, val) percpu_xchg_op(pcp, val) #define raw_cpu_xchg_4(pcp, val) percpu_xchg_op(pcp, val) #define this_cpu_read_1(pcp) percpu_from_op("mov", pcp) #define this_cpu_read_2(pcp) percpu_from_op("mov", pcp) #define this_cpu_read_4(pcp) percpu_from_op("mov", pcp) #define this_cpu_write_1(pcp, val) percpu_to_op("mov", (pcp), val) #define this_cpu_write_2(pcp, val) percpu_to_op("mov", (pcp), val) #define this_cpu_write_4(pcp, val) percpu_to_op("mov", (pcp), val) #define this_cpu_add_1(pcp, val) percpu_add_op((pcp), val) #define this_cpu_add_2(pcp, val) percpu_add_op((pcp), val) #define this_cpu_add_4(pcp, val) percpu_add_op((pcp), val) #define this_cpu_and_1(pcp, val) percpu_to_op("and", (pcp), val) #define this_cpu_and_2(pcp, val) percpu_to_op("and", (pcp), val) #define this_cpu_and_4(pcp, val) percpu_to_op("and", (pcp), val) #define this_cpu_or_1(pcp, val) percpu_to_op("or", (pcp), val) #define this_cpu_or_2(pcp, val) percpu_to_op("or", (pcp), val) #define this_cpu_or_4(pcp, val) percpu_to_op("or", (pcp), val) #define this_cpu_xchg_1(pcp, nval) percpu_xchg_op(pcp, nval) #define this_cpu_xchg_2(pcp, nval) percpu_xchg_op(pcp, nval) #define this_cpu_xchg_4(pcp, nval) percpu_xchg_op(pcp, nval) #define raw_cpu_add_return_1(pcp, val) percpu_add_return_op(pcp, val) #define raw_cpu_add_return_2(pcp, val) percpu_add_return_op(pcp, val) #define raw_cpu_add_return_4(pcp, val) percpu_add_return_op(pcp, val) #define raw_cpu_cmpxchg_1(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval) #define raw_cpu_cmpxchg_2(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval) #define raw_cpu_cmpxchg_4(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval) #define this_cpu_add_return_1(pcp, val) percpu_add_return_op(pcp, val) #define this_cpu_add_return_2(pcp, val) percpu_add_return_op(pcp, val) #define this_cpu_add_return_4(pcp, val) percpu_add_return_op(pcp, val) #define this_cpu_cmpxchg_1(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval) #define this_cpu_cmpxchg_2(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval) #define this_cpu_cmpxchg_4(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval) #ifdef CONFIG_X86_CMPXCHG64 #define percpu_cmpxchg8b_double(pcp1, pcp2, o1, o2, n1, n2) \ ({ \ bool __ret; \ typeof(pcp1) __o1 = (o1), __n1 = (n1); \ typeof(pcp2) __o2 = (o2), __n2 = (n2); \ asm volatile("cmpxchg8b "__percpu_arg(1)"\n\tsetz %0\n\t" \ : "=a" (__ret), "+m" (pcp1), "+m" (pcp2), "+d" (__o2) \ : "b" (__n1), "c" (__n2), "a" (__o1)); \ __ret; \ }) #define raw_cpu_cmpxchg_double_4 percpu_cmpxchg8b_double #define this_cpu_cmpxchg_double_4 percpu_cmpxchg8b_double #endif /* CONFIG_X86_CMPXCHG64 */ # 466 "./arch/x86/include/asm/percpu.h" /* * Per cpu atomic 64 bit operations are only available under 64 bit. * 32 bit must fall back to generic operations. */ #ifdef CONFIG_X86_64 #define raw_cpu_read_8(pcp) percpu_from_op("mov", pcp) #define raw_cpu_write_8(pcp, val) percpu_to_op("mov", (pcp), val) #define raw_cpu_add_8(pcp, val) percpu_add_op((pcp), val) #define raw_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val) #define raw_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val) #define raw_cpu_add_return_8(pcp, val) percpu_add_return_op(pcp, val) #define raw_cpu_xchg_8(pcp, nval) percpu_xchg_op(pcp, nval) #define raw_cpu_cmpxchg_8(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval) #define this_cpu_read_8(pcp) percpu_from_op("mov", pcp) #define this_cpu_write_8(pcp, val) percpu_to_op("mov", (pcp), val) #define this_cpu_add_8(pcp, val) percpu_add_op((pcp), val) #define this_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val) #define this_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val) #define this_cpu_add_return_8(pcp, val) percpu_add_return_op(pcp, val) #define this_cpu_xchg_8(pcp, nval) percpu_xchg_op(pcp, nval) #define this_cpu_cmpxchg_8(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval) /* * Pretty complex macro to generate cmpxchg16 instruction. The instruction * is not supported on early AMD64 processors so we must be able to emulate * it in software. The address used in the cmpxchg16 instruction must be * aligned to a 16 byte boundary. */ #define percpu_cmpxchg16b_double(pcp1, pcp2, o1, o2, n1, n2) \ ({ \ bool __ret; \ typeof(pcp1) __o1 = (o1), __n1 = (n1); \ typeof(pcp2) __o2 = (o2), __n2 = (n2); \ alternative_io("leaq %P1,%%rsi\n\tcall this_cpu_cmpxchg16b_emu\n\t", \ "cmpxchg16b " __percpu_arg(1) "\n\tsetz %0\n\t", \ X86_FEATURE_CX16, \ ASM_OUTPUT2("=a" (__ret), "+m" (pcp1), \ "+m" (pcp2), "+d" (__o2)), \ "b" (__n1), "c" (__n2), "a" (__o1) : "rsi"); \ __ret; \ }) #define raw_cpu_cmpxchg_double_8 percpu_cmpxchg16b_double #define this_cpu_cmpxchg_double_8 percpu_cmpxchg16b_double #endif # 514 "./arch/x86/include/asm/percpu.h" static __always_inline bool x86_this_cpu_constant_test_bit(unsigned int nr, const unsigned long __percpu *addr) { unsigned long __percpu *a = (unsigned long __percpu *)addr + nr / BITS_PER_LONG; #ifdef CONFIG_X86_64 return ((1UL << (nr % BITS_PER_LONG)) & raw_cpu_read_8(*a)) != 0; #else # 524 "./arch/x86/include/asm/percpu.h" return ((1UL << (nr % BITS_PER_LONG)) & raw_cpu_read_4(*a)) != 0; #endif # 526 "./arch/x86/include/asm/percpu.h" } static inline bool x86_this_cpu_variable_test_bit(int nr, const unsigned long __percpu *addr) { bool oldbit; asm volatile("bt "__percpu_arg(2)",%1" CC_SET(c) : CC_OUT(c) (oldbit) : "m" (*(unsigned long __percpu *)addr), "Ir" (nr)); return oldbit; } #define x86_this_cpu_test_bit(nr, addr) \ (__builtin_constant_p((nr)) \ ? x86_this_cpu_constant_test_bit((nr), (addr)) \ : x86_this_cpu_variable_test_bit((nr), (addr))) #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 547 "./arch/x86/include/asm/percpu.h" # 1 "./include/asm-generic/percpu.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_GENERIC_PERCPU_H_ #define _ASM_GENERIC_PERCPU_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/asm-generic/percpu.h" # 6 "./include/asm-generic/percpu.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./include/asm-generic/percpu.h" # 1 "./include/linux/threads.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LINUX_THREADS_H #define _LINUX_THREADS_H /* * The default limit for the nr of threads is now in * /proc/sys/kernel/threads-max. */ /* * Maximum supported processors. Setting this smaller saves quite a * bit of memory. Use nr_cpu_ids instead of this except for static bitmaps. */ #ifndef CONFIG_NR_CPUS /* FIXME: This should be fixed in the arch's Kconfig */ #define CONFIG_NR_CPUS 1 #endif # 19 "./include/linux/threads.h" /* Places which use this should consider cpumask_var_t. */ #define NR_CPUS CONFIG_NR_CPUS #define MIN_THREADS_LEFT_FOR_ROOT 4 /* * This controls the default maximum pid allocated to a process */ #define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000) /* * A maximum of 4 million PIDs should be enough for a while. * [NOTE: PID/TIDs are limited to 2^29 ~= 500+ million, see futex.h.] */ #define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \ (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT)) /* * Define a minimum number of pids per cpu. Heuristically based * on original pid max of 32k for 32 cpus. Also, increase the * minimum settable value for pid_max on the running system based * on similar defaults. See kernel/pid.c:pidmap_init() for details. */ #define PIDS_PER_CPU_DEFAULT 1024 #define PIDS_PER_CPU_MIN 8 #endif # 47 "./include/linux/threads.h" # 7 "./include/asm-generic/percpu.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 7 "./include/asm-generic/percpu.h" # 1 "./include/linux/percpu-defs.h" 1 /* * linux/percpu-defs.h - basic definitions for percpu areas * * DO NOT INCLUDE DIRECTLY OUTSIDE PERCPU IMPLEMENTATION PROPER. * * This file is separate from linux/percpu.h to avoid cyclic inclusion * dependency from arch header files. Only to be included from * asm/percpu.h. * * This file includes macros necessary to declare percpu sections and * variables, and definitions of percpu accessors and operations. It * should provide enough percpu features to arch header files even when * they can only include asm/percpu.h to avoid cyclic inclusion dependency. */ #ifndef _LINUX_PERCPU_DEFS_H #define _LINUX_PERCPU_DEFS_H #ifdef CONFIG_SMP #ifdef MODULE #define PER_CPU_SHARED_ALIGNED_SECTION "" #define PER_CPU_ALIGNED_SECTION "" #else # 25 "./include/linux/percpu-defs.h" #define PER_CPU_SHARED_ALIGNED_SECTION "..shared_aligned" #define PER_CPU_ALIGNED_SECTION "..shared_aligned" #endif # 28 "./include/linux/percpu-defs.h" #define PER_CPU_FIRST_SECTION "..first" #else # 31 "./include/linux/percpu-defs.h" #define PER_CPU_SHARED_ALIGNED_SECTION "" #define PER_CPU_ALIGNED_SECTION "..shared_aligned" #define PER_CPU_FIRST_SECTION "" #endif # 37 "./include/linux/percpu-defs.h" /* * Base implementations of per-CPU variable declarations and definitions, where * the section in which the variable is to be placed is provided by the * 'sec' argument. This may be used to affect the parameters governing the * variable's storage. * * NOTE! The sections for the DECLARE and for the DEFINE must match, lest * linkage errors occur due the compiler generating the wrong code to access * that section. */ #define __PCPU_ATTRS(sec) \ __percpu __attribute__((section(PER_CPU_BASE_SECTION sec))) \ PER_CPU_ATTRIBUTES #define __PCPU_DUMMY_ATTRS \ __attribute__((section(".discard"), unused)) /* * s390 and alpha modules require percpu variables to be defined as * weak to force the compiler to generate GOT based external * references for them. This is necessary because percpu sections * will be located outside of the usually addressable area. * * This definition puts the following two extra restrictions when * defining percpu variables. * * 1. The symbol must be globally unique, even the static ones. * 2. Static percpu variables cannot be defined inside a function. * * Archs which need weak percpu definitions should define * ARCH_NEEDS_WEAK_PER_CPU in asm/percpu.h when necessary. * * To ensure that the generic code observes the above two * restrictions, if CONFIG_DEBUG_FORCE_WEAK_PER_CPU is set weak * definition is used for all cases. */ #if defined(ARCH_NEEDS_WEAK_PER_CPU) || defined(CONFIG_DEBUG_FORCE_WEAK_PER_CPU) /* * __pcpu_scope_* dummy variable is used to enforce scope. It * receives the static modifier when it's used in front of * DEFINE_PER_CPU() and will trigger build failure if * DECLARE_PER_CPU() is used for the same variable. * * __pcpu_unique_* dummy variable is used to enforce symbol uniqueness * such that hidden weak symbol collision, which will cause unrelated * variables to share the same address, can be detected during build. */ #define DECLARE_PER_CPU_SECTION(type, name, sec) \ extern __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ extern __PCPU_ATTRS(sec) __typeof__(type) name #define DEFINE_PER_CPU_SECTION(type, name, sec) \ __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ extern __PCPU_ATTRS(sec) __typeof__(type) name; \ __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \ __typeof__(type) name #else # 97 "./include/linux/percpu-defs.h" /* * Normal declaration and definition macros. */ #define DECLARE_PER_CPU_SECTION(type, name, sec) \ extern __PCPU_ATTRS(sec) __typeof__(type) name #define DEFINE_PER_CPU_SECTION(type, name, sec) \ __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES \ __typeof__(type) name #endif # 107 "./include/linux/percpu-defs.h" /* * Variant on the per-CPU variable declaration/definition theme used for * ordinary per-CPU variables. */ #define DECLARE_PER_CPU(type, name) \ DECLARE_PER_CPU_SECTION(type, name, "") #define DEFINE_PER_CPU(type, name) \ DEFINE_PER_CPU_SECTION(type, name, "") /* * Declaration/definition used for per-CPU variables that must come first in * the set of variables. */ #define DECLARE_PER_CPU_FIRST(type, name) \ DECLARE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION) #define DEFINE_PER_CPU_FIRST(type, name) \ DEFINE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION) /* * Declaration/definition used for per-CPU variables that must be cacheline * aligned under SMP conditions so that, whilst a particular instance of the * data corresponds to a particular CPU, inefficiencies due to direct access by * other CPUs are reduced by preventing the data from unnecessarily spanning * cachelines. * * An example of this would be statistical data, where each CPU's set of data * is updated by that CPU alone, but the data from across all CPUs is collated * by a CPU processing a read from a proc file. */ #define DECLARE_PER_CPU_SHARED_ALIGNED(type, name) \ DECLARE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \ ____cacheline_aligned_in_smp #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \ ____cacheline_aligned_in_smp #define DECLARE_PER_CPU_ALIGNED(type, name) \ DECLARE_PER_CPU_SECTION(type, name, PER_CPU_ALIGNED_SECTION) \ ____cacheline_aligned #define DEFINE_PER_CPU_ALIGNED(type, name) \ DEFINE_PER_CPU_SECTION(type, name, PER_CPU_ALIGNED_SECTION) \ ____cacheline_aligned /* * Declaration/definition used for per-CPU variables that must be page aligned. */ #define DECLARE_PER_CPU_PAGE_ALIGNED(type, name) \ DECLARE_PER_CPU_SECTION(type, name, "..page_aligned") \ __aligned(PAGE_SIZE) #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ DEFINE_PER_CPU_SECTION(type, name, "..page_aligned") \ __aligned(PAGE_SIZE) /* * Declaration/definition used for per-CPU variables that must be read mostly. */ #define DECLARE_PER_CPU_READ_MOSTLY(type, name) \ DECLARE_PER_CPU_SECTION(type, name, "..read_mostly") #define DEFINE_PER_CPU_READ_MOSTLY(type, name) \ DEFINE_PER_CPU_SECTION(type, name, "..read_mostly") /* * Declaration/definition used for per-CPU variables that should be accessed * as decrypted when memory encryption is enabled in the guest. */ #if defined(CONFIG_VIRTUALIZATION) && defined(CONFIG_AMD_MEM_ENCRYPT) #define DECLARE_PER_CPU_DECRYPTED(type, name) \ DECLARE_PER_CPU_SECTION(type, name, "..decrypted") #define DEFINE_PER_CPU_DECRYPTED(type, name) \ DEFINE_PER_CPU_SECTION(type, name, "..decrypted") #else # 187 "./include/linux/percpu-defs.h" #define DEFINE_PER_CPU_DECRYPTED(type, name) DEFINE_PER_CPU(type, name) #endif # 189 "./include/linux/percpu-defs.h" /* * Intermodule exports for per-CPU variables. sparse forgets about * address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to * noop if __CHECKER__. */ #ifndef __CHECKER__ #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(var) #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(var) #else # 199 "./include/linux/percpu-defs.h" #define EXPORT_PER_CPU_SYMBOL(var) #define EXPORT_PER_CPU_SYMBOL_GPL(var) #endif # 202 "./include/linux/percpu-defs.h" /* * Accessors and operations. */ #ifndef __ASSEMBLY__ /* * __verify_pcpu_ptr() verifies @ptr is a percpu pointer without evaluating * @ptr and is invoked once before a percpu area is accessed by all * accessors and operations. This is performed in the generic part of * percpu and arch overrides don't need to worry about it; however, if an * arch wants to implement an arch-specific percpu accessor or operation, * it may use __verify_pcpu_ptr() to verify the parameters. * * + 0 is required in order to convert the pointer type from a * potential array type to a pointer to a single item of the array. */ #define __verify_pcpu_ptr(ptr) \ do { \ const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \ (void)__vpp_verify; \ } while (0) #ifdef CONFIG_SMP /* * Add an offset to a pointer but keep the pointer as-is. Use RELOC_HIDE() * to prevent the compiler from making incorrect assumptions about the * pointer value. The weird cast keeps both GCC and sparse happy. */ #define SHIFT_PERCPU_PTR(__p, __offset) \ RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset)) #define per_cpu_ptr(ptr, cpu) \ ({ \ __verify_pcpu_ptr(ptr); \ SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))); \ }) #define raw_cpu_ptr(ptr) \ ({ \ __verify_pcpu_ptr(ptr); \ arch_raw_cpu_ptr(ptr); \ }) #ifdef CONFIG_DEBUG_PREEMPT #define this_cpu_ptr(ptr) \ ({ \ __verify_pcpu_ptr(ptr); \ SHIFT_PERCPU_PTR(ptr, my_cpu_offset); \ }) #else # 254 "./include/linux/percpu-defs.h" #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) #endif # 256 "./include/linux/percpu-defs.h" #else /* CONFIG_SMP */ # 258 "./include/linux/percpu-defs.h" #define VERIFY_PERCPU_PTR(__p) \ ({ \ __verify_pcpu_ptr(__p); \ (typeof(*(__p)) __kernel __force *)(__p); \ }) #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); }) #define raw_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr) #endif /* CONFIG_SMP */ # 270 "./include/linux/percpu-defs.h" #define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu)) /* * Must be an lvalue. Since @var must be a simple identifier, * we force a syntax error here if it isn't. */ #define get_cpu_var(var) \ (*({ \ preempt_disable(); \ this_cpu_ptr(&var); \ })) /* * The weird & is necessary because sparse considers (void)(var) to be * a direct dereference of percpu variable (var). */ #define put_cpu_var(var) \ do { \ (void)&(var); \ preempt_enable(); \ } while (0) #define get_cpu_ptr(var) \ ({ \ preempt_disable(); \ this_cpu_ptr(var); \ }) #define put_cpu_ptr(var) \ do { \ (void)(var); \ preempt_enable(); \ } while (0) /* * Branching function to split up a function into a set of functions that * are called for different scalar sizes of the objects handled. */ extern void __bad_size_call_parameter(void); #ifdef CONFIG_DEBUG_PREEMPT extern void __this_cpu_preempt_check(const char *op); #else # 315 "./include/linux/percpu-defs.h" static inline void __this_cpu_preempt_check(const char *op) { } #endif # 317 "./include/linux/percpu-defs.h" #define __pcpu_size_call_return(stem, variable) \ ({ \ typeof(variable) pscr_ret__; \ __verify_pcpu_ptr(&(variable)); \ switch(sizeof(variable)) { \ case 1: pscr_ret__ = stem##1(variable); break; \ case 2: pscr_ret__ = stem##2(variable); break; \ case 4: pscr_ret__ = stem##4(variable); break; \ case 8: pscr_ret__ = stem##8(variable); break; \ default: \ __bad_size_call_parameter(); break; \ } \ pscr_ret__; \ }) #define __pcpu_size_call_return2(stem, variable, ...) \ ({ \ typeof(variable) pscr2_ret__; \ __verify_pcpu_ptr(&(variable)); \ switch(sizeof(variable)) { \ case 1: pscr2_ret__ = stem##1(variable, __VA_ARGS__); break; \ case 2: pscr2_ret__ = stem##2(variable, __VA_ARGS__); break; \ case 4: pscr2_ret__ = stem##4(variable, __VA_ARGS__); break; \ case 8: pscr2_ret__ = stem##8(variable, __VA_ARGS__); break; \ default: \ __bad_size_call_parameter(); break; \ } \ pscr2_ret__; \ }) /* * Special handling for cmpxchg_double. cmpxchg_double is passed two * percpu variables. The first has to be aligned to a double word * boundary and the second has to follow directly thereafter. * We enforce this on all architectures even if they don't support * a double cmpxchg instruction, since it's a cheap requirement, and it * avoids breaking the requirement for architectures with the instruction. */ #define __pcpu_double_call_return_bool(stem, pcp1, pcp2, ...) \ ({ \ bool pdcrb_ret__; \ __verify_pcpu_ptr(&(pcp1)); \ BUILD_BUG_ON(sizeof(pcp1) != sizeof(pcp2)); \ VM_BUG_ON((unsigned long)(&(pcp1)) % (2 * sizeof(pcp1))); \ VM_BUG_ON((unsigned long)(&(pcp2)) != \ (unsigned long)(&(pcp1)) + sizeof(pcp1)); \ switch(sizeof(pcp1)) { \ case 1: pdcrb_ret__ = stem##1(pcp1, pcp2, __VA_ARGS__); break; \ case 2: pdcrb_ret__ = stem##2(pcp1, pcp2, __VA_ARGS__); break; \ case 4: pdcrb_ret__ = stem##4(pcp1, pcp2, __VA_ARGS__); break; \ case 8: pdcrb_ret__ = stem##8(pcp1, pcp2, __VA_ARGS__); break; \ default: \ __bad_size_call_parameter(); break; \ } \ pdcrb_ret__; \ }) #define __pcpu_size_call(stem, variable, ...) \ do { \ __verify_pcpu_ptr(&(variable)); \ switch(sizeof(variable)) { \ case 1: stem##1(variable, __VA_ARGS__);break; \ case 2: stem##2(variable, __VA_ARGS__);break; \ case 4: stem##4(variable, __VA_ARGS__);break; \ case 8: stem##8(variable, __VA_ARGS__);break; \ default: \ __bad_size_call_parameter();break; \ } \ } while (0) /* * this_cpu operations (C) 2008-2013 Christoph Lameter * * Optimized manipulation for memory allocated through the per cpu * allocator or for addresses of per cpu variables. * * These operation guarantee exclusivity of access for other operations * on the *same* processor. The assumption is that per cpu data is only * accessed by a single processor instance (the current one). * * The arch code can provide optimized implementation by defining macros * for certain scalar sizes. F.e. provide this_cpu_add_2() to provide per * cpu atomic operations for 2 byte sized RMW actions. If arch code does * not provide operations for a scalar size then the fallback in the * generic code will be used. * * cmpxchg_double replaces two adjacent scalars at once. The first two * parameters are per cpu variables which have to be of the same size. A * truth value is returned to indicate success or failure (since a double * register result is difficult to handle). There is very limited hardware * support for these operations, so only certain sizes may work. */ /* * Operations for contexts where we do not want to do any checks for * preemptions. Unless strictly necessary, always use [__]this_cpu_*() * instead. * * If there is no other protection through preempt disable and/or disabling * interupts then one of these RMW operations can show unexpected behavior * because the execution thread was rescheduled on another processor or an * interrupt occurred and the same percpu variable was modified from the * interrupt context. */ #define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, pcp) #define raw_cpu_write(pcp, val) __pcpu_size_call(raw_cpu_write_, pcp, val) #define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, pcp, val) #define raw_cpu_and(pcp, val) __pcpu_size_call(raw_cpu_and_, pcp, val) #define raw_cpu_or(pcp, val) __pcpu_size_call(raw_cpu_or_, pcp, val) #define raw_cpu_add_return(pcp, val) __pcpu_size_call_return2(raw_cpu_add_return_, pcp, val) #define raw_cpu_xchg(pcp, nval) __pcpu_size_call_return2(raw_cpu_xchg_, pcp, nval) #define raw_cpu_cmpxchg(pcp, oval, nval) \ __pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval) #define raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ __pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, pcp1, pcp2, oval1, oval2, nval1, nval2) #define raw_cpu_sub(pcp, val) raw_cpu_add(pcp, -(val)) #define raw_cpu_inc(pcp) raw_cpu_add(pcp, 1) #define raw_cpu_dec(pcp) raw_cpu_sub(pcp, 1) #define raw_cpu_sub_return(pcp, val) raw_cpu_add_return(pcp, -(typeof(pcp))(val)) #define raw_cpu_inc_return(pcp) raw_cpu_add_return(pcp, 1) #define raw_cpu_dec_return(pcp) raw_cpu_add_return(pcp, -1) /* * Operations for contexts that are safe from preemption/interrupts. These * operations verify that preemption is disabled. */ #define __this_cpu_read(pcp) \ ({ \ __this_cpu_preempt_check("read"); \ raw_cpu_read(pcp); \ }) #define __this_cpu_write(pcp, val) \ ({ \ __this_cpu_preempt_check("write"); \ raw_cpu_write(pcp, val); \ }) #define __this_cpu_add(pcp, val) \ ({ \ __this_cpu_preempt_check("add"); \ raw_cpu_add(pcp, val); \ }) #define __this_cpu_and(pcp, val) \ ({ \ __this_cpu_preempt_check("and"); \ raw_cpu_and(pcp, val); \ }) #define __this_cpu_or(pcp, val) \ ({ \ __this_cpu_preempt_check("or"); \ raw_cpu_or(pcp, val); \ }) #define __this_cpu_add_return(pcp, val) \ ({ \ __this_cpu_preempt_check("add_return"); \ raw_cpu_add_return(pcp, val); \ }) #define __this_cpu_xchg(pcp, nval) \ ({ \ __this_cpu_preempt_check("xchg"); \ raw_cpu_xchg(pcp, nval); \ }) #define __this_cpu_cmpxchg(pcp, oval, nval) \ ({ \ __this_cpu_preempt_check("cmpxchg"); \ raw_cpu_cmpxchg(pcp, oval, nval); \ }) #define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ ({ __this_cpu_preempt_check("cmpxchg_double"); \ raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2); \ }) #define __this_cpu_sub(pcp, val) __this_cpu_add(pcp, -(typeof(pcp))(val)) #define __this_cpu_inc(pcp) __this_cpu_add(pcp, 1) #define __this_cpu_dec(pcp) __this_cpu_sub(pcp, 1) #define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val)) #define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1) #define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1) /* * Operations with implied preemption/interrupt protection. These * operations can be used without worrying about preemption or interrupt. */ #define this_cpu_read(pcp) __pcpu_size_call_return(this_cpu_read_, pcp) #define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val) #define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pcp, val) #define this_cpu_and(pcp, val) __pcpu_size_call(this_cpu_and_, pcp, val) #define this_cpu_or(pcp, val) __pcpu_size_call(this_cpu_or_, pcp, val) #define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val) #define this_cpu_xchg(pcp, nval) __pcpu_size_call_return2(this_cpu_xchg_, pcp, nval) #define this_cpu_cmpxchg(pcp, oval, nval) \ __pcpu_size_call_return2(this_cpu_cmpxchg_, pcp, oval, nval) #define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, pcp1, pcp2, oval1, oval2, nval1, nval2) #define this_cpu_sub(pcp, val) this_cpu_add(pcp, -(typeof(pcp))(val)) #define this_cpu_inc(pcp) this_cpu_add(pcp, 1) #define this_cpu_dec(pcp) this_cpu_sub(pcp, 1) #define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(typeof(pcp))(val)) #define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1) #define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1) #endif /* __ASSEMBLY__ */ # 529 "./include/linux/percpu-defs.h" #endif /* _LINUX_PERCPU_DEFS_H */ # 530 "./include/linux/percpu-defs.h" # 8 "./include/asm-generic/percpu.h" 2 #ifdef CONFIG_SMP /* * per_cpu_offset() is the offset that has to be added to a * percpu variable to get to the instance for a certain processor. * * Most arches use the __per_cpu_offset array for those offsets but * some arches have their own ways of determining the offset (x86_64, s390). */ #ifndef __per_cpu_offset extern unsigned long __per_cpu_offset[NR_CPUS]; #define per_cpu_offset(x) (__per_cpu_offset[x]) #endif # 23 "./include/asm-generic/percpu.h" /* * Determine the offset for the currently active processor. * An arch may define __my_cpu_offset to provide a more effective * means of obtaining the offset to the per cpu variables of the * current processor. */ #ifndef __my_cpu_offset #define __my_cpu_offset per_cpu_offset(raw_smp_processor_id()) #endif # 33 "./include/asm-generic/percpu.h" #ifdef CONFIG_DEBUG_PREEMPT #define my_cpu_offset per_cpu_offset(smp_processor_id()) #else # 36 "./include/asm-generic/percpu.h" #define my_cpu_offset __my_cpu_offset #endif # 38 "./include/asm-generic/percpu.h" /* * Arch may define arch_raw_cpu_ptr() to provide more efficient address * translations for raw_cpu_ptr(). */ #ifndef arch_raw_cpu_ptr #define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset) #endif # 46 "./include/asm-generic/percpu.h" #ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA extern void setup_per_cpu_areas(void); #endif # 50 "./include/asm-generic/percpu.h" #endif /* SMP */ # 52 "./include/asm-generic/percpu.h" #ifndef PER_CPU_BASE_SECTION #ifdef CONFIG_SMP #define PER_CPU_BASE_SECTION ".data..percpu" #else # 57 "./include/asm-generic/percpu.h" #define PER_CPU_BASE_SECTION ".data" #endif # 59 "./include/asm-generic/percpu.h" #endif # 60 "./include/asm-generic/percpu.h" #ifndef PER_CPU_ATTRIBUTES #define PER_CPU_ATTRIBUTES #endif # 64 "./include/asm-generic/percpu.h" #ifndef PER_CPU_DEF_ATTRIBUTES #define PER_CPU_DEF_ATTRIBUTES #endif # 68 "./include/asm-generic/percpu.h" #define raw_cpu_generic_read(pcp) \ ({ \ *raw_cpu_ptr(&(pcp)); \ }) #define raw_cpu_generic_to_op(pcp, val, op) \ do { \ *raw_cpu_ptr(&(pcp)) op val; \ } while (0) #define raw_cpu_generic_add_return(pcp, val) \ ({ \ typeof(&(pcp)) __p = raw_cpu_ptr(&(pcp)); \ \ *__p += val; \ *__p; \ }) #define raw_cpu_generic_xchg(pcp, nval) \ ({ \ typeof(&(pcp)) __p = raw_cpu_ptr(&(pcp)); \ typeof(pcp) __ret; \ __ret = *__p; \ *__p = nval; \ __ret; \ }) #define raw_cpu_generic_cmpxchg(pcp, oval, nval) \ ({ \ typeof(&(pcp)) __p = raw_cpu_ptr(&(pcp)); \ typeof(pcp) __ret; \ __ret = *__p; \ if (__ret == (oval)) \ *__p = nval; \ __ret; \ }) #define raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ ({ \ typeof(&(pcp1)) __p1 = raw_cpu_ptr(&(pcp1)); \ typeof(&(pcp2)) __p2 = raw_cpu_ptr(&(pcp2)); \ int __ret = 0; \ if (*__p1 == (oval1) && *__p2 == (oval2)) { \ *__p1 = nval1; \ *__p2 = nval2; \ __ret = 1; \ } \ (__ret); \ }) #define __this_cpu_generic_read_nopreempt(pcp) \ ({ \ typeof(pcp) __ret; \ preempt_disable_notrace(); \ __ret = READ_ONCE(*raw_cpu_ptr(&(pcp))); \ preempt_enable_notrace(); \ __ret; \ }) #define __this_cpu_generic_read_noirq(pcp) \ ({ \ typeof(pcp) __ret; \ unsigned long __flags; \ raw_local_irq_save(__flags); \ __ret = raw_cpu_generic_read(pcp); \ raw_local_irq_restore(__flags); \ __ret; \ }) #define this_cpu_generic_read(pcp) \ ({ \ typeof(pcp) __ret; \ if (__native_word(pcp)) \ __ret = __this_cpu_generic_read_nopreempt(pcp); \ else \ __ret = __this_cpu_generic_read_noirq(pcp); \ __ret; \ }) #define this_cpu_generic_to_op(pcp, val, op) \ do { \ unsigned long __flags; \ raw_local_irq_save(__flags); \ raw_cpu_generic_to_op(pcp, val, op); \ raw_local_irq_restore(__flags); \ } while (0) #define this_cpu_generic_add_return(pcp, val) \ ({ \ typeof(pcp) __ret; \ unsigned long __flags; \ raw_local_irq_save(__flags); \ __ret = raw_cpu_generic_add_return(pcp, val); \ raw_local_irq_restore(__flags); \ __ret; \ }) #define this_cpu_generic_xchg(pcp, nval) \ ({ \ typeof(pcp) __ret; \ unsigned long __flags; \ raw_local_irq_save(__flags); \ __ret = raw_cpu_generic_xchg(pcp, nval); \ raw_local_irq_restore(__flags); \ __ret; \ }) #define this_cpu_generic_cmpxchg(pcp, oval, nval) \ ({ \ typeof(pcp) __ret; \ unsigned long __flags; \ raw_local_irq_save(__flags); \ __ret = raw_cpu_generic_cmpxchg(pcp, oval, nval); \ raw_local_irq_restore(__flags); \ __ret; \ }) #define this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ ({ \ int __ret; \ unsigned long __flags; \ raw_local_irq_save(__flags); \ __ret = raw_cpu_generic_cmpxchg_double(pcp1, pcp2, \ oval1, oval2, nval1, nval2); \ raw_local_irq_restore(__flags); \ __ret; \ }) #ifndef raw_cpu_read_1 #define raw_cpu_read_1(pcp) raw_cpu_generic_read(pcp) #endif # 201 "./include/asm-generic/percpu.h" #ifndef raw_cpu_read_2 #define raw_cpu_read_2(pcp) raw_cpu_generic_read(pcp) #endif # 204 "./include/asm-generic/percpu.h" #ifndef raw_cpu_read_4 #define raw_cpu_read_4(pcp) raw_cpu_generic_read(pcp) #endif # 207 "./include/asm-generic/percpu.h" #ifndef raw_cpu_read_8 #define raw_cpu_read_8(pcp) raw_cpu_generic_read(pcp) #endif # 210 "./include/asm-generic/percpu.h" #ifndef raw_cpu_write_1 #define raw_cpu_write_1(pcp, val) raw_cpu_generic_to_op(pcp, val, =) #endif # 214 "./include/asm-generic/percpu.h" #ifndef raw_cpu_write_2 #define raw_cpu_write_2(pcp, val) raw_cpu_generic_to_op(pcp, val, =) #endif # 217 "./include/asm-generic/percpu.h" #ifndef raw_cpu_write_4 #define raw_cpu_write_4(pcp, val) raw_cpu_generic_to_op(pcp, val, =) #endif # 220 "./include/asm-generic/percpu.h" #ifndef raw_cpu_write_8 #define raw_cpu_write_8(pcp, val) raw_cpu_generic_to_op(pcp, val, =) #endif # 223 "./include/asm-generic/percpu.h" #ifndef raw_cpu_add_1 #define raw_cpu_add_1(pcp, val) raw_cpu_generic_to_op(pcp, val, +=) #endif # 227 "./include/asm-generic/percpu.h" #ifndef raw_cpu_add_2 #define raw_cpu_add_2(pcp, val) raw_cpu_generic_to_op(pcp, val, +=) #endif # 230 "./include/asm-generic/percpu.h" #ifndef raw_cpu_add_4 #define raw_cpu_add_4(pcp, val) raw_cpu_generic_to_op(pcp, val, +=) #endif # 233 "./include/asm-generic/percpu.h" #ifndef raw_cpu_add_8 #define raw_cpu_add_8(pcp, val) raw_cpu_generic_to_op(pcp, val, +=) #endif # 236 "./include/asm-generic/percpu.h" #ifndef raw_cpu_and_1 #define raw_cpu_and_1(pcp, val) raw_cpu_generic_to_op(pcp, val, &=) #endif # 240 "./include/asm-generic/percpu.h" #ifndef raw_cpu_and_2 #define raw_cpu_and_2(pcp, val) raw_cpu_generic_to_op(pcp, val, &=) #endif # 243 "./include/asm-generic/percpu.h" #ifndef raw_cpu_and_4 #define raw_cpu_and_4(pcp, val) raw_cpu_generic_to_op(pcp, val, &=) #endif # 246 "./include/asm-generic/percpu.h" #ifndef raw_cpu_and_8 #define raw_cpu_and_8(pcp, val) raw_cpu_generic_to_op(pcp, val, &=) #endif # 249 "./include/asm-generic/percpu.h" #ifndef raw_cpu_or_1 #define raw_cpu_or_1(pcp, val) raw_cpu_generic_to_op(pcp, val, |=) #endif # 253 "./include/asm-generic/percpu.h" #ifndef raw_cpu_or_2 #define raw_cpu_or_2(pcp, val) raw_cpu_generic_to_op(pcp, val, |=) #endif # 256 "./include/asm-generic/percpu.h" #ifndef raw_cpu_or_4 #define raw_cpu_or_4(pcp, val) raw_cpu_generic_to_op(pcp, val, |=) #endif # 259 "./include/asm-generic/percpu.h" #ifndef raw_cpu_or_8 #define raw_cpu_or_8(pcp, val) raw_cpu_generic_to_op(pcp, val, |=) #endif # 262 "./include/asm-generic/percpu.h" #ifndef raw_cpu_add_return_1 #define raw_cpu_add_return_1(pcp, val) raw_cpu_generic_add_return(pcp, val) #endif # 266 "./include/asm-generic/percpu.h" #ifndef raw_cpu_add_return_2 #define raw_cpu_add_return_2(pcp, val) raw_cpu_generic_add_return(pcp, val) #endif # 269 "./include/asm-generic/percpu.h" #ifndef raw_cpu_add_return_4 #define raw_cpu_add_return_4(pcp, val) raw_cpu_generic_add_return(pcp, val) #endif # 272 "./include/asm-generic/percpu.h" #ifndef raw_cpu_add_return_8 #define raw_cpu_add_return_8(pcp, val) raw_cpu_generic_add_return(pcp, val) #endif # 275 "./include/asm-generic/percpu.h" #ifndef raw_cpu_xchg_1 #define raw_cpu_xchg_1(pcp, nval) raw_cpu_generic_xchg(pcp, nval) #endif # 279 "./include/asm-generic/percpu.h" #ifndef raw_cpu_xchg_2 #define raw_cpu_xchg_2(pcp, nval) raw_cpu_generic_xchg(pcp, nval) #endif # 282 "./include/asm-generic/percpu.h" #ifndef raw_cpu_xchg_4 #define raw_cpu_xchg_4(pcp, nval) raw_cpu_generic_xchg(pcp, nval) #endif # 285 "./include/asm-generic/percpu.h" #ifndef raw_cpu_xchg_8 #define raw_cpu_xchg_8(pcp, nval) raw_cpu_generic_xchg(pcp, nval) #endif # 288 "./include/asm-generic/percpu.h" #ifndef raw_cpu_cmpxchg_1 #define raw_cpu_cmpxchg_1(pcp, oval, nval) \ raw_cpu_generic_cmpxchg(pcp, oval, nval) #endif # 293 "./include/asm-generic/percpu.h" #ifndef raw_cpu_cmpxchg_2 #define raw_cpu_cmpxchg_2(pcp, oval, nval) \ raw_cpu_generic_cmpxchg(pcp, oval, nval) #endif # 297 "./include/asm-generic/percpu.h" #ifndef raw_cpu_cmpxchg_4 #define raw_cpu_cmpxchg_4(pcp, oval, nval) \ raw_cpu_generic_cmpxchg(pcp, oval, nval) #endif # 301 "./include/asm-generic/percpu.h" #ifndef raw_cpu_cmpxchg_8 #define raw_cpu_cmpxchg_8(pcp, oval, nval) \ raw_cpu_generic_cmpxchg(pcp, oval, nval) #endif # 305 "./include/asm-generic/percpu.h" #ifndef raw_cpu_cmpxchg_double_1 #define raw_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \ raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) #endif # 310 "./include/asm-generic/percpu.h" #ifndef raw_cpu_cmpxchg_double_2 #define raw_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \ raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) #endif # 314 "./include/asm-generic/percpu.h" #ifndef raw_cpu_cmpxchg_double_4 #define raw_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \ raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) #endif # 318 "./include/asm-generic/percpu.h" #ifndef raw_cpu_cmpxchg_double_8 #define raw_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \ raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) #endif # 322 "./include/asm-generic/percpu.h" #ifndef this_cpu_read_1 #define this_cpu_read_1(pcp) this_cpu_generic_read(pcp) #endif # 326 "./include/asm-generic/percpu.h" #ifndef this_cpu_read_2 #define this_cpu_read_2(pcp) this_cpu_generic_read(pcp) #endif # 329 "./include/asm-generic/percpu.h" #ifndef this_cpu_read_4 #define this_cpu_read_4(pcp) this_cpu_generic_read(pcp) #endif # 332 "./include/asm-generic/percpu.h" #ifndef this_cpu_read_8 #define this_cpu_read_8(pcp) this_cpu_generic_read(pcp) #endif # 335 "./include/asm-generic/percpu.h" #ifndef this_cpu_write_1 #define this_cpu_write_1(pcp, val) this_cpu_generic_to_op(pcp, val, =) #endif # 339 "./include/asm-generic/percpu.h" #ifndef this_cpu_write_2 #define this_cpu_write_2(pcp, val) this_cpu_generic_to_op(pcp, val, =) #endif # 342 "./include/asm-generic/percpu.h" #ifndef this_cpu_write_4 #define this_cpu_write_4(pcp, val) this_cpu_generic_to_op(pcp, val, =) #endif # 345 "./include/asm-generic/percpu.h" #ifndef this_cpu_write_8 #define this_cpu_write_8(pcp, val) this_cpu_generic_to_op(pcp, val, =) #endif # 348 "./include/asm-generic/percpu.h" #ifndef this_cpu_add_1 #define this_cpu_add_1(pcp, val) this_cpu_generic_to_op(pcp, val, +=) #endif # 352 "./include/asm-generic/percpu.h" #ifndef this_cpu_add_2 #define this_cpu_add_2(pcp, val) this_cpu_generic_to_op(pcp, val, +=) #endif # 355 "./include/asm-generic/percpu.h" #ifndef this_cpu_add_4 #define this_cpu_add_4(pcp, val) this_cpu_generic_to_op(pcp, val, +=) #endif # 358 "./include/asm-generic/percpu.h" #ifndef this_cpu_add_8 #define this_cpu_add_8(pcp, val) this_cpu_generic_to_op(pcp, val, +=) #endif # 361 "./include/asm-generic/percpu.h" #ifndef this_cpu_and_1 #define this_cpu_and_1(pcp, val) this_cpu_generic_to_op(pcp, val, &=) #endif # 365 "./include/asm-generic/percpu.h" #ifndef this_cpu_and_2 #define this_cpu_and_2(pcp, val) this_cpu_generic_to_op(pcp, val, &=) #endif # 368 "./include/asm-generic/percpu.h" #ifndef this_cpu_and_4 #define this_cpu_and_4(pcp, val) this_cpu_generic_to_op(pcp, val, &=) #endif # 371 "./include/asm-generic/percpu.h" #ifndef this_cpu_and_8 #define this_cpu_and_8(pcp, val) this_cpu_generic_to_op(pcp, val, &=) #endif # 374 "./include/asm-generic/percpu.h" #ifndef this_cpu_or_1 #define this_cpu_or_1(pcp, val) this_cpu_generic_to_op(pcp, val, |=) #endif # 378 "./include/asm-generic/percpu.h" #ifndef this_cpu_or_2 #define this_cpu_or_2(pcp, val) this_cpu_generic_to_op(pcp, val, |=) #endif # 381 "./include/asm-generic/percpu.h" #ifndef this_cpu_or_4 #define this_cpu_or_4(pcp, val) this_cpu_generic_to_op(pcp, val, |=) #endif # 384 "./include/asm-generic/percpu.h" #ifndef this_cpu_or_8 #define this_cpu_or_8(pcp, val) this_cpu_generic_to_op(pcp, val, |=) #endif # 387 "./include/asm-generic/percpu.h" #ifndef this_cpu_add_return_1 #define this_cpu_add_return_1(pcp, val) this_cpu_generic_add_return(pcp, val) #endif # 391 "./include/asm-generic/percpu.h" #ifndef this_cpu_add_return_2 #define this_cpu_add_return_2(pcp, val) this_cpu_generic_add_return(pcp, val) #endif # 394 "./include/asm-generic/percpu.h" #ifndef this_cpu_add_return_4 #define this_cpu_add_return_4(pcp, val) this_cpu_generic_add_return(pcp, val) #endif # 397 "./include/asm-generic/percpu.h" #ifndef this_cpu_add_return_8 #define this_cpu_add_return_8(pcp, val) this_cpu_generic_add_return(pcp, val) #endif # 400 "./include/asm-generic/percpu.h" #ifndef this_cpu_xchg_1 #define this_cpu_xchg_1(pcp, nval) this_cpu_generic_xchg(pcp, nval) #endif # 404 "./include/asm-generic/percpu.h" #ifndef this_cpu_xchg_2 #define this_cpu_xchg_2(pcp, nval) this_cpu_generic_xchg(pcp, nval) #endif # 407 "./include/asm-generic/percpu.h" #ifndef this_cpu_xchg_4 #define this_cpu_xchg_4(pcp, nval) this_cpu_generic_xchg(pcp, nval) #endif # 410 "./include/asm-generic/percpu.h" #ifndef this_cpu_xchg_8 #define this_cpu_xchg_8(pcp, nval) this_cpu_generic_xchg(pcp, nval) #endif # 413 "./include/asm-generic/percpu.h" #ifndef this_cpu_cmpxchg_1 #define this_cpu_cmpxchg_1(pcp, oval, nval) \ this_cpu_generic_cmpxchg(pcp, oval, nval) #endif # 418 "./include/asm-generic/percpu.h" #ifndef this_cpu_cmpxchg_2 #define this_cpu_cmpxchg_2(pcp, oval, nval) \ this_cpu_generic_cmpxchg(pcp, oval, nval) #endif # 422 "./include/asm-generic/percpu.h" #ifndef this_cpu_cmpxchg_4 #define this_cpu_cmpxchg_4(pcp, oval, nval) \ this_cpu_generic_cmpxchg(pcp, oval, nval) #endif # 426 "./include/asm-generic/percpu.h" #ifndef this_cpu_cmpxchg_8 #define this_cpu_cmpxchg_8(pcp, oval, nval) \ this_cpu_generic_cmpxchg(pcp, oval, nval) #endif # 430 "./include/asm-generic/percpu.h" #ifndef this_cpu_cmpxchg_double_1 #define this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \ this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) #endif # 435 "./include/asm-generic/percpu.h" #ifndef this_cpu_cmpxchg_double_2 #define this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \ this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) #endif # 439 "./include/asm-generic/percpu.h" #ifndef this_cpu_cmpxchg_double_4 #define this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \ this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) #endif # 443 "./include/asm-generic/percpu.h" #ifndef this_cpu_cmpxchg_double_8 #define this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \ this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) #endif # 447 "./include/asm-generic/percpu.h" #endif /* _ASM_GENERIC_PERCPU_H_ */ # 449 "./include/asm-generic/percpu.h" # 548 "./arch/x86/include/asm/percpu.h" 2 /* We can use this directly for local CPU (faster). */ DECLARE_PER_CPU_READ_MOSTLY(unsigned long, this_cpu_off); #endif /* !__ASSEMBLY__ */ # 553 "./arch/x86/include/asm/percpu.h" #ifdef CONFIG_SMP /* * Define the "EARLY_PER_CPU" macros. These are used for some per_cpu * variables that are initialized and accessed before there are per_cpu * areas allocated. */ #define DEFINE_EARLY_PER_CPU(_type, _name, _initvalue) \ DEFINE_PER_CPU(_type, _name) = _initvalue; \ __typeof__(_type) _name##_early_map[NR_CPUS] __initdata = \ { [0 ... NR_CPUS-1] = _initvalue }; \ __typeof__(_type) *_name##_early_ptr __refdata = _name##_early_map #define DEFINE_EARLY_PER_CPU_READ_MOSTLY(_type, _name, _initvalue) \ DEFINE_PER_CPU_READ_MOSTLY(_type, _name) = _initvalue; \ __typeof__(_type) _name##_early_map[NR_CPUS] __initdata = \ { [0 ... NR_CPUS-1] = _initvalue }; \ __typeof__(_type) *_name##_early_ptr __refdata = _name##_early_map #define EXPORT_EARLY_PER_CPU_SYMBOL(_name) \ EXPORT_PER_CPU_SYMBOL(_name) #define DECLARE_EARLY_PER_CPU(_type, _name) \ DECLARE_PER_CPU(_type, _name); \ extern __typeof__(_type) *_name##_early_ptr; \ extern __typeof__(_type) _name##_early_map[] #define DECLARE_EARLY_PER_CPU_READ_MOSTLY(_type, _name) \ DECLARE_PER_CPU_READ_MOSTLY(_type, _name); \ extern __typeof__(_type) *_name##_early_ptr; \ extern __typeof__(_type) _name##_early_map[] #define early_per_cpu_ptr(_name) (_name##_early_ptr) #define early_per_cpu_map(_name, _idx) (_name##_early_map[_idx]) #define early_per_cpu(_name, _cpu) \ *(early_per_cpu_ptr(_name) ? \ &early_per_cpu_ptr(_name)[_cpu] : \ &per_cpu(_name, _cpu)) #else /* !CONFIG_SMP */ # 595 "./arch/x86/include/asm/percpu.h" #define DEFINE_EARLY_PER_CPU(_type, _name, _initvalue) \ DEFINE_PER_CPU(_type, _name) = _initvalue #define DEFINE_EARLY_PER_CPU_READ_MOSTLY(_type, _name, _initvalue) \ DEFINE_PER_CPU_READ_MOSTLY(_type, _name) = _initvalue #define EXPORT_EARLY_PER_CPU_SYMBOL(_name) \ EXPORT_PER_CPU_SYMBOL(_name) #define DECLARE_EARLY_PER_CPU(_type, _name) \ DECLARE_PER_CPU(_type, _name) #define DECLARE_EARLY_PER_CPU_READ_MOSTLY(_type, _name) \ DECLARE_PER_CPU_READ_MOSTLY(_type, _name) #define early_per_cpu(_name, _cpu) per_cpu(_name, _cpu) #define early_per_cpu_ptr(_name) NULL /* no early_per_cpu_map() */ #endif /* !CONFIG_SMP */ # 615 "./arch/x86/include/asm/percpu.h" #endif /* _ASM_X86_PERCPU_H */ # 617 "./arch/x86/include/asm/percpu.h" # 7 "./arch/x86/include/asm/preempt.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 7 "./arch/x86/include/asm/preempt.h" # 1 "./include/linux/thread_info.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ /* thread_info.h: common low-level thread information accessors * * Copyright (C) 2002 David Howells (dhowells@redhat.com) * - Incorporating suggestions made by Linus Torvalds */ #ifndef _LINUX_THREAD_INFO_H #define _LINUX_THREAD_INFO_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 11 "./include/linux/thread_info.h" # 12 "./include/linux/thread_info.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 12 "./include/linux/thread_info.h" # 13 "./include/linux/thread_info.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 13 "./include/linux/thread_info.h" # 1 "./include/linux/restart_block.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ /* * Common syscall restarting data */ #ifndef __LINUX_RESTART_BLOCK_H #define __LINUX_RESTART_BLOCK_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 8 "./include/linux/restart_block.h" # 9 "./include/linux/restart_block.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 9 "./include/linux/restart_block.h" # 10 "./include/linux/restart_block.h" struct timespec; struct compat_timespec; struct pollfd; enum timespec_type { TT_NONE = 0, TT_NATIVE = 1, #ifdef CONFIG_COMPAT TT_COMPAT = 2, #endif # 21 "./include/linux/restart_block.h" }; /* * System call restart block. */ struct restart_block { long (*fn)(struct restart_block *); union { /* For futex_wait and futex_wait_requeue_pi */ struct { u32 __user *uaddr; u32 val; u32 flags; u32 bitset; u64 time; u32 __user *uaddr2; } futex; /* For nanosleep */ struct { clockid_t clockid; enum timespec_type type; union { struct timespec __user *rmtp; #ifdef CONFIG_COMPAT struct compat_timespec __user *compat_rmtp; #endif # 47 "./include/linux/restart_block.h" }; u64 expires; } nanosleep; /* For poll */ struct { struct pollfd __user *ufds; int nfds; int has_timeout; unsigned long tv_sec; unsigned long tv_nsec; } poll; }; }; extern long do_no_restart_syscall(struct restart_block *parm); #endif /* __LINUX_RESTART_BLOCK_H */ # 64 "./include/linux/restart_block.h" # 14 "./include/linux/thread_info.h" 2 #ifdef CONFIG_THREAD_INFO_IN_TASK /* * For CONFIG_THREAD_INFO_IN_TASK kernels we need for the * definition of current, but for !CONFIG_THREAD_INFO_IN_TASK kernels, * including can cause a circular dependency on some platforms. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 21 "./include/linux/thread_info.h" # 1 "./arch/x86/include/asm/current.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_CURRENT_H #define _ASM_X86_CURRENT_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./arch/x86/include/asm/current.h" # 6 "./arch/x86/include/asm/current.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./arch/x86/include/asm/current.h" # 7 "./arch/x86/include/asm/current.h" #ifndef __ASSEMBLY__ struct task_struct; DECLARE_PER_CPU(struct task_struct *, current_task); static __always_inline struct task_struct *get_current(void) { return this_cpu_read_stable(current_task); } #define current get_current() #endif /* __ASSEMBLY__ */ # 21 "./arch/x86/include/asm/current.h" #endif /* _ASM_X86_CURRENT_H */ # 23 "./arch/x86/include/asm/current.h" # 22 "./include/linux/thread_info.h" 2 #define current_thread_info() ((struct thread_info *)current) #endif # 24 "./include/linux/thread_info.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 25 "./include/linux/thread_info.h" # 26 "./include/linux/thread_info.h" /* * For per-arch arch_within_stack_frames() implementations, defined in * asm/thread_info.h. */ enum { BAD_STACK = -1, NOT_STACK = 0, GOOD_FRAME, GOOD_STACK, }; #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "./include/linux/thread_info.h" # 1 "./arch/x86/include/asm/thread_info.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ /* thread_info.h: low-level thread information * * Copyright (C) 2002 David Howells (dhowells@redhat.com) * - Incorporating suggestions made by Linus Torvalds and Dave Miller */ #ifndef _ASM_X86_THREAD_INFO_H #define _ASM_X86_THREAD_INFO_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 11 "./arch/x86/include/asm/thread_info.h" # 12 "./arch/x86/include/asm/thread_info.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 12 "./arch/x86/include/asm/thread_info.h" # 1 "./arch/x86/include/asm/page.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_PAGE_H #define _ASM_X86_PAGE_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./arch/x86/include/asm/page.h" # 6 "./arch/x86/include/asm/page.h" #ifdef __KERNEL__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 9 "./arch/x86/include/asm/page.h" # 1 "./arch/x86/include/asm/page_types.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_PAGE_DEFS_H #define _ASM_X86_PAGE_DEFS_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./arch/x86/include/asm/page_types.h" # 6 "./arch/x86/include/asm/page_types.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "./arch/x86/include/asm/page_types.h" # 7 "./arch/x86/include/asm/page_types.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 7 "./arch/x86/include/asm/page_types.h" # 1 "./include/linux/mem_encrypt.h" 1 /* * AMD Memory Encryption Support * * Copyright (C) 2016 Advanced Micro Devices, Inc. * * Author: Tom Lendacky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __MEM_ENCRYPT_H__ #define __MEM_ENCRYPT_H__ #ifndef __ASSEMBLY__ #ifdef CONFIG_ARCH_HAS_MEM_ENCRYPT #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 20 "./include/linux/mem_encrypt.h" # 1 "./arch/x86/include/asm/mem_encrypt.h" 1 /* * AMD Memory Encryption Support * * Copyright (C) 2016 Advanced Micro Devices, Inc. * * Author: Tom Lendacky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __X86_MEM_ENCRYPT_H__ #define __X86_MEM_ENCRYPT_H__ #ifndef __ASSEMBLY__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 18 "./arch/x86/include/asm/mem_encrypt.h" # 19 "./arch/x86/include/asm/mem_encrypt.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 20 "./arch/x86/include/asm/mem_encrypt.h" # 1 "./arch/x86/include/uapi/asm/bootparam.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_X86_BOOTPARAM_H #define _ASM_X86_BOOTPARAM_H /* setup_data types */ #define SETUP_NONE 0 #define SETUP_E820_EXT 1 #define SETUP_DTB 2 #define SETUP_PCI 3 #define SETUP_EFI 4 #define SETUP_APPLE_PROPERTIES 5 /* ram_size flags */ #define RAMDISK_IMAGE_START_MASK 0x07FF #define RAMDISK_PROMPT_FLAG 0x8000 #define RAMDISK_LOAD_FLAG 0x4000 /* loadflags */ #define LOADED_HIGH (1<<0) #define KASLR_FLAG (1<<1) #define QUIET_FLAG (1<<5) #define KEEP_SEGMENTS (1<<6) #define CAN_USE_HEAP (1<<7) /* xloadflags */ #define XLF_KERNEL_64 (1<<0) #define XLF_CAN_BE_LOADED_ABOVE_4G (1<<1) #define XLF_EFI_HANDOVER_32 (1<<2) #define XLF_EFI_HANDOVER_64 (1<<3) #define XLF_EFI_KEXEC (1<<4) #ifndef __ASSEMBLY__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "./arch/x86/include/uapi/asm/bootparam.h" # 35 "./arch/x86/include/uapi/asm/bootparam.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "./arch/x86/include/uapi/asm/bootparam.h" # 1 "./include/linux/screen_info.h" 1 /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _SCREEN_INFO_H #define _SCREEN_INFO_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/linux/screen_info.h" # 1 "./include/uapi/linux/screen_info.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UAPI_SCREEN_INFO_H #define _UAPI_SCREEN_INFO_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/uapi/linux/screen_info.h" # 6 "./include/uapi/linux/screen_info.h" /* * These are set up by the setup-routine at boot-time: */ struct screen_info { __u8 orig_x; /* 0x00 */ __u8 orig_y; /* 0x01 */ __u16 ext_mem_k; /* 0x02 */ __u16 orig_video_page; /* 0x04 */ __u8 orig_video_mode; /* 0x06 */ __u8 orig_video_cols; /* 0x07 */ __u8 flags; /* 0x08 */ __u8 unused2; /* 0x09 */ __u16 orig_video_ega_bx;/* 0x0a */ __u16 unused3; /* 0x0c */ __u8 orig_video_lines; /* 0x0e */ __u8 orig_video_isVGA; /* 0x0f */ __u16 orig_video_points;/* 0x10 */ /* VESA graphic mode -- linear frame buffer */ __u16 lfb_width; /* 0x12 */ __u16 lfb_height; /* 0x14 */ __u16 lfb_depth; /* 0x16 */ __u32 lfb_base; /* 0x18 */ __u32 lfb_size; /* 0x1c */ __u16 cl_magic, cl_offset; /* 0x20 */ __u16 lfb_linelength; /* 0x24 */ __u8 red_size; /* 0x26 */ __u8 red_pos; /* 0x27 */ __u8 green_size; /* 0x28 */ __u8 green_pos; /* 0x29 */ __u8 blue_size; /* 0x2a */ __u8 blue_pos; /* 0x2b */ __u8 rsvd_size; /* 0x2c */ __u8 rsvd_pos; /* 0x2d */ __u16 vesapm_seg; /* 0x2e */ __u16 vesapm_off; /* 0x30 */ __u16 pages; /* 0x32 */ __u16 vesa_attributes; /* 0x34 */ __u32 capabilities; /* 0x36 */ __u32 ext_lfb_base; /* 0x3a */ __u8 _reserved[2]; /* 0x3e */ } __attribute__((packed)); #define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */ #define VIDEO_TYPE_CGA 0x11 /* CGA Display */ #define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */ #define VIDEO_TYPE_EGAC 0x21 /* EGA in Color Mode */ #define VIDEO_TYPE_VGAC 0x22 /* VGA+ in Color Mode */ #define VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */ #define VIDEO_TYPE_PICA_S3 0x30 /* ACER PICA-61 local S3 video */ #define VIDEO_TYPE_MIPS_G364 0x31 /* MIPS Magnum 4000 G364 video */ #define VIDEO_TYPE_SGI 0x33 /* Various SGI graphics hardware */ #define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */ #define VIDEO_TYPE_SUN 0x50 /* Sun frame buffer. */ #define VIDEO_TYPE_SUNPCI 0x51 /* Sun PCI based frame buffer. */ #define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */ #define VIDEO_TYPE_EFI 0x70 /* EFI graphic mode */ #define VIDEO_FLAGS_NOCURSOR (1 << 0) /* The video mode has no cursor set */ #define VIDEO_CAPABILITY_SKIP_QUIRKS (1 << 0) #define VIDEO_CAPABILITY_64BIT_BASE (1 << 1) /* Frame buffer base is 64-bit */ #endif /* _UAPI_SCREEN_INFO_H */ # 77 "./include/uapi/linux/screen_info.h" # 6 "./include/linux/screen_info.h" 2 extern struct screen_info screen_info; #endif /* _SCREEN_INFO_H */ # 10 "./include/linux/screen_info.h" # 36 "./arch/x86/include/uapi/asm/bootparam.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "./arch/x86/include/uapi/asm/bootparam.h" # 1 "./include/linux/apm_bios.h" 1 /* * Include file for the interface to an APM BIOS * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. */ #ifndef _LINUX_APM_H #define _LINUX_APM_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 18 "./include/linux/apm_bios.h" # 1 "./include/uapi/linux/apm_bios.h" 1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Include file for the interface to an APM BIOS * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. */ #ifndef _UAPI_LINUX_APM_H #define _UAPI_LINUX_APM_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 20 "./include/uapi/linux/apm_bios.h" # 21 "./include/uapi/linux/apm_bios.h" typedef unsigned short apm_event_t; typedef unsigned short apm_eventinfo_t; struct apm_bios_info { __u16 version; __u16 cseg; __u32 offset; __u16 cseg_16; __u16 dseg; __u16 flags; __u16 cseg_len; __u16 cseg_16_len; __u16 dseg_len; }; /* * Power states */ #define APM_STATE_READY 0x0000 #define APM_STATE_STANDBY 0x0001 #define APM_STATE_SUSPEND 0x0002 #define APM_STATE_OFF 0x0003 #define APM_STATE_BUSY 0x0004 #define APM_STATE_REJECT 0x0005 #define APM_STATE_OEM_SYS 0x0020 #define APM_STATE_OEM_DEV 0x0040 #define APM_STATE_DISABLE 0x0000 #define APM_STATE_ENABLE 0x0001 #define APM_STATE_DISENGAGE 0x0000 #define APM_STATE_ENGAGE 0x0001 /* * Events (results of Get PM Event) */ #define APM_SYS_STANDBY 0x0001 #define APM_SYS_SUSPEND 0x0002 #define APM_NORMAL_RESUME 0x0003 #define APM_CRITICAL_RESUME 0x0004 #define APM_LOW_BATTERY 0x0005 #define APM_POWER_STATUS_CHANGE 0x0006 #define APM_UPDATE_TIME 0x0007 #define APM_CRITICAL_SUSPEND 0x0008 #define APM_USER_STANDBY 0x0009 #define APM_USER_SUSPEND 0x000a #define APM_STANDBY_RESUME 0x000b #define APM_CAPABILITY_CHANGE 0x000c #define APM_USER_HIBERNATION 0x000d #define APM_HIBERNATION_RESUME 0x000e /* * Error codes */ #define APM_SUCCESS 0x00 #define APM_DISABLED 0x01 #define APM_CONNECTED 0x02 #define APM_NOT_CONNECTED 0x03 #define APM_16_CONNECTED 0x05 #define APM_16_UNSUPPORTED 0x06 #define APM_32_CONNECTED 0x07 #define APM_32_UNSUPPORTED 0x08 #define APM_BAD_DEVICE 0x09 #define APM_BAD_PARAM 0x0a #define APM_NOT_ENGAGED 0x0b #define APM_BAD_FUNCTION 0x0c #define APM_RESUME_DISABLED 0x0d #define APM_NO_ERROR 0x53 #define APM_BAD_STATE 0x60 #define APM_NO_EVENTS 0x80 #define APM_NOT_PRESENT 0x86 /* * APM Device IDs */ #define APM_DEVICE_BIOS 0x0000 #define APM_DEVICE_ALL 0x0001 #define APM_DEVICE_DISPLAY 0x0100 #define APM_DEVICE_STORAGE 0x0200 #define APM_DEVICE_PARALLEL 0x0300 #define APM_DEVICE_SERIAL 0x0400 #define APM_DEVICE_NETWORK 0x0500 #define APM_DEVICE_PCMCIA 0x0600 #define APM_DEVICE_BATTERY 0x8000 #define APM_DEVICE_OEM 0xe000 #define APM_DEVICE_OLD_ALL 0xffff #define APM_DEVICE_CLASS 0x00ff #define APM_DEVICE_MASK 0xff00 /* * Battery status */ #define APM_MAX_BATTERIES 2 /* * APM defined capability bit flags */ #define APM_CAP_GLOBAL_STANDBY 0x0001 #define APM_CAP_GLOBAL_SUSPEND 0x0002 #define APM_CAP_RESUME_STANDBY_TIMER 0x0004 /* Timer resume from standby */ #define APM_CAP_RESUME_SUSPEND_TIMER 0x0008 /* Timer resume from suspend */ #define APM_CAP_RESUME_STANDBY_RING 0x0010 /* Resume on Ring fr standby */ #define APM_CAP_RESUME_SUSPEND_RING 0x0020 /* Resume on Ring fr suspend */ #define APM_CAP_RESUME_STANDBY_PCMCIA 0x0040 /* Resume on PCMCIA Ring */ #define APM_CAP_RESUME_SUSPEND_PCMCIA 0x0080 /* Resume on PCMCIA Ring */ /* * ioctl operations */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 133 "./include/uapi/linux/apm_bios.h" # 1 "./include/uapi/linux/ioctl.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _LINUX_IOCTL_H #define _LINUX_IOCTL_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 5 "./include/uapi/linux/ioctl.h" # 1 "./arch/x86/include/uapi/asm/ioctl.h" 1 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 1 "./arch/x86/include/uapi/asm/ioctl.h" # 2 "./arch/x86/include/uapi/asm/ioctl.h" # 6 "./include/uapi/linux/ioctl.h" 2 #endif /* _LINUX_IOCTL_H */ # 8 "./include/uapi/linux/ioctl.h" # 134 "./include/uapi/linux/apm_bios.h" 2 #define APM_IOC_STANDBY _IO('A', 1) #define APM_IOC_SUSPEND _IO('A', 2) #endif /* _UAPI_LINUX_APM_H */ # 139 "./include/uapi/linux/apm_bios.h" # 19 "./include/linux/apm_bios.h" 2 #define APM_CS (GDT_ENTRY_APMBIOS_BASE * 8) #define APM_CS_16 (APM_CS + 8) #define APM_DS (APM_CS_16 + 8) /* Results of APM Installation Check */ #define APM_16_BIT_SUPPORT 0x0001 #define APM_32_BIT_SUPPORT 0x0002 #define APM_IDLE_SLOWS_CLOCK 0x0004 #define APM_BIOS_DISABLED 0x0008 #define APM_BIOS_DISENGAGED 0x0010 /* * Data for APM that is persistent across module unload/load */ struct apm_info { struct apm_bios_info bios; unsigned short connection_version; int get_power_status_broken; int get_power_status_swabinminutes; int allow_ints; int forbid_idle; int realmode_power_off; int disabled; }; /* * The APM function codes */ #define APM_FUNC_INST_CHECK 0x5300 #define APM_FUNC_REAL_CONN 0x5301 #define APM_FUNC_16BIT_CONN 0x5302 #define APM_FUNC_32BIT_CONN 0x5303 #define APM_FUNC_DISCONN 0x5304 #define APM_FUNC_IDLE 0x5305 #define APM_FUNC_BUSY 0x5306 #define APM_FUNC_SET_STATE 0x5307 #define APM_FUNC_ENABLE_PM 0x5308 #define APM_FUNC_RESTORE_BIOS 0x5309 #define APM_FUNC_GET_STATUS 0x530a #define APM_FUNC_GET_EVENT 0x530b #define APM_FUNC_GET_STATE 0x530c #define APM_FUNC_ENABLE_DEV_PM 0x530d #define APM_FUNC_VERSION 0x530e #define APM_FUNC_ENGAGE_PM 0x530f #define APM_FUNC_GET_CAP 0x5310 #define APM_FUNC_RESUME_TIMER 0x5311 #define APM_FUNC_RESUME_ON_RING 0x5312 #define APM_FUNC_TIMER 0x5313 /* * Function code for APM_FUNC_RESUME_TIMER */ #define APM_FUNC_DISABLE_TIMER 0 #define APM_FUNC_GET_TIMER 1 #define APM_FUNC_SET_TIMER 2 /* * Function code for APM_FUNC_RESUME_ON_RING */ #define APM_FUNC_DISABLE_RING 0 #define APM_FUNC_ENABLE_RING 1 #define APM_FUNC_GET_RING 2 /* * Function code for APM_FUNC_TIMER_STATUS */ #define APM_FUNC_TIMER_DISABLE 0 #define APM_FUNC_TIMER_ENABLE 1 #define APM_FUNC_TIMER_GET 2 /* * in arch/i386/kernel/setup.c */ extern struct apm_info apm_info; /* * This is the "All Devices" ID communicated to the BIOS */ #define APM_DEVICE_BALL ((apm_info.connection_version > 0x0100) ? \ APM_DEVICE_ALL : APM_DEVICE_OLD_ALL) #endif /* LINUX_APM_H */ # 102 "./include/linux/apm_bios.h" # 37 "./arch/x86/include/uapi/asm/bootparam.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "./arch/x86/include/uapi/asm/bootparam.h" # 1 "./include/linux/edd.h" 1 /* * linux/include/linux/edd.h * Copyright (C) 2002, 2003, 2004 Dell Inc. * by Matt Domsch * * structures and definitions for the int 13h, ax={41,48}h * BIOS Enhanced Disk Drive Services * This is based on the T13 group document D1572 Revision 0 (August 14 2002) * available at http://www.t13.org/docs2002/d1572r0.pdf. It is * very similar to D1484 Revision 3 http://www.t13.org/docs2002/d1484r3.pdf * * In a nutshell, arch/{i386,x86_64}/boot/setup.S populates a scratch * table in the boot_params that contains a list of BIOS-enumerated * boot devices. * In arch/{i386,x86_64}/kernel/setup.c, this information is * transferred into the edd structure, and in drivers/firmware/edd.c, that * information is used to identify BIOS boot disk. The code in setup.S * is very sensitive to the size of these structures. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License v2.0 as published by * the Free Software Foundation * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #ifndef _LINUX_EDD_H #define _LINUX_EDD_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "./include/linux/edd.h" # 1 "./include/uapi/linux/edd.h" 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * linux/include/linux/edd.h * Copyright (C) 2002, 2003, 2004 Dell Inc. * by Matt Domsch * * structures and definitions for the int 13h, ax={41,48}h * BIOS Enhanced Disk Drive Services * This is based on the T13 group document D1572 Revision 0 (August 14 2002) * available at http://www.t13.org/docs2002/d1572r0.pdf. It is * very similar to D1484 Revision 3 http://www.t13.org/docs2002/d1484r3.pdf * * In a nutshell, arch/{i386,x86_64}/boot/setup.S populates a scratch * table in the boot_params that contains a list of BIOS-enumerated * boot devices. * In arch/{i386,x86_64}/kernel/setup.c, this information is * transferred into the edd structure, and in drivers/firmware/edd.c, that * information is used to identify BIOS boot disk. The code in setup.S * is very sensitive to the size of these structures. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License v2.0 as published by * the Free Software Foundation * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #ifndef _UAPI_LINUX_EDD_H #define _UAPI_LINUX_EDD_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "./include/uapi/linux/edd.h" # 35 "./include/uapi/linux/edd.h" #define EDDNR 0x1e9 /* addr of number of edd_info structs at EDDBUF in boot_params - treat this as 1 byte */ #define EDDBUF 0xd00 /* addr of edd_info structs in boot_params */ #define EDDMAXNR 6 /* number of edd_info structs starting at EDDBUF */ #define EDDEXTSIZE 8 /* change these if you muck with the structures */ #define EDDPARMSIZE 74 #define CHECKEXTENSIONSPRESENT 0x41 #define GETDEVICEPARAMETERS 0x48 #define LEGACYGETDEVICEPARAMETERS 0x08 #define EDDMAGIC1 0x55AA #define EDDMAGIC2 0xAA55 #define READ_SECTORS 0x02 /* int13 AH=0x02 is READ_SECTORS command */ #define EDD_MBR_SIG_OFFSET 0x1B8 /* offset of signature in the MBR */ #define EDD_MBR_SIG_BUF 0x290 /* addr in boot params */ #define EDD_MBR_SIG_MAX 16 /* max number of signatures to store */ #define EDD_MBR_SIG_NR_BUF 0x1ea /* addr of number of MBR signtaures at EDD_MBR_SIG_BUF in boot_params - treat this as 1 byte */ #ifndef __ASSEMBLY__ #define EDD_EXT_FIXED_DISK_ACCESS (1 << 0) #define EDD_EXT_DEVICE_LOCKING_AND_EJECTING (1 << 1) #define EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT (1 << 2) #define EDD_EXT_64BIT_EXTENSIONS (1 << 3) #define EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT (1 << 0) #define EDD_INFO_GEOMETRY_VALID (1 << 1) #define EDD_INFO_REMOVABLE (1 << 2) #define EDD_INFO_WRITE_VERIFY (1 << 3) #define EDD_INFO_MEDIA_CHANGE_NOTIFICATION (1 << 4) #define EDD_INFO_LOCKABLE (1 << 5) #define EDD_INFO_NO_MEDIA_PRESENT (1 << 6) #define EDD_INFO_USE_INT13_FN50 (1 << 7) struct edd_device_params { __u16 length; __u16 info_flags; __u32 num_default_cylinders; __u32 num_default_heads; __u32 sectors_per_track; __u64 number_of_sectors; __u16 bytes_per_sector; __u32 dpte_ptr; /* 0xFFFFFFFF for our purposes */ __u16 key; /* = 0xBEDD */ __u8 device_path_info_length; /* = 44 */ __u8 reserved2; __u16 reserved3; __u8 host_bus_type[4]; __u8 interface_type[8]; union { struct { __u16 base_address; __u16 reserved1; __u32 reserved2; } __attribute__ ((packed)) isa; struct { __u8 bus; __u8 slot; __u8 function; __u8 channel; __u32 reserved; } __attribute__ ((packed)) pci; /* pcix is same as pci */ struct { __u64 reserved; } __attribute__ ((packed)) ibnd; struct { __u64 reserved; } __attribute__ ((packed)) xprs; struct { __u64 reserved; } __attribute__ ((packed)) htpt; struct { __u64 reserved; } __attribute__ ((packed)) unknown; } interface_path; union { struct { __u8 device; __u8 reserved1; __u16 reserved2; __u32 reserved3; __u64 reserved4; } __attribute__ ((packed)) ata; struct { __u8 device; __u8 lun; __u8 reserved1; __u8 reserved2; __u32 reserved3; __u64 reserved4; } __attribute__ ((packed)) atapi; struct { __u16 id; __u64 lun; __u16 reserved1; __u32 reserved2; } __attribute__ ((packed)) scsi; struct { __u64 serial_number; __u64 reserved; } __attribute__ ((packed)) usb; struct { __u64 eui; __u64 reserved; } __attribute__ ((packed)) i1394; struct { __u64 wwid; __u64 lun; } __attribute__ ((packed)) fibre; struct { __u64 identity_tag; __u64 reserved; } __attribute__ ((packed)) i2o; struct { __u32 array_number; __u32 reserved1; __u64 reserved2; } __attribute__ ((packed)) raid; struct { __u8 device; __u8 reserved1; __u16 reserved2; __u32 reserved3; __u64 reserved4; } __attribute__ ((packed)) sata; struct { __u64 reserved1; __u64 reserved2; } __attribute__ ((packed)) unknown; } device_path; __u8 reserved4; __u8 checksum; } __attribute__ ((packed)); struct edd_info { __u8 device; __u8 version; __u16 interface_support; __u16 legacy_max_cylinder; __u8 legacy_max_head; __u8 legacy_sectors_per_track; struct edd_device_params params; } __attribute__ ((packed)); struct edd { unsigned int mbr_signature[EDD_MBR_SIG_MAX]; struct edd_info edd_info[EDDMAXNR]; unsigned char mbr_signature_nr; unsigned char edd_info_nr; }; #endif /*!__ASSEMBLY__ */ # 191 "./include/uapi/linux/edd.h" #endif /* _UAPI_LINUX_EDD_H */ # 193 "./include/uapi/linux/edd.h" # 34 "./include/linux/edd.h" 2 #ifndef __ASSEMBLY__ extern struct edd edd; #endif /*!__ASSEMBLY__ */ # 38 "./include/linux/edd.h" #endif /* _LINUX_EDD_H */ # 39 "./include/linux/edd.h" # 38 "./arch/x86/include/uapi/asm/bootparam.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "./arch/x86/include/uapi/asm/bootparam.h" # 1 "./arch/x86/include/asm/ist.h" 1 /* * Include file for the interface to IST BIOS * Copyright 2002 Andy Grover * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. */ #ifndef _ASM_X86_IST_H #define _ASM_X86_IST_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 18 "./arch/x86/include/asm/ist.h" # 1 "./arch/x86/include/uapi/asm/ist.h" 1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Include file for the interface to IST BIOS * Copyright 2002 Andy Grover * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. */ #ifndef _UAPI_ASM_X86_IST_H #define _UAPI_ASM_X86_IST_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 21 "./arch/x86/include/uapi/asm/ist.h" # 22 "./arch/x86/include/uapi/asm/ist.h" struct ist_info { __u32 signature; __u32 command; __u32 event; __u32 perf_level; }; #endif /* _UAPI_ASM_X86_IST_H */ # 31 "./arch/x86/include/uapi/asm/ist.h" # 19 "./arch/x86/include/asm/ist.h" 2 extern struct ist_info ist_info; #endif /* _ASM_X86_IST_H */ # 24 "./arch/x86/include/asm/ist.h" # 39 "./arch/x86/include/uapi/asm/bootparam.h" 2 #if 0 /* expanded by -frewrite-includes */ #include