From patchwork Fri Apr 1 15:49:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 64876 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp811717lbc; Fri, 1 Apr 2016 08:52:13 -0700 (PDT) X-Received: by 10.66.121.97 with SMTP id lj1mr31895414pab.51.1459525933546; Fri, 01 Apr 2016 08:52:13 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qk3si6636708pac.28.2016.04.01.08.52.13; Fri, 01 Apr 2016 08:52:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932642AbcDAPvk (ORCPT + 29 others); Fri, 1 Apr 2016 11:51:40 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:35269 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932618AbcDAPvh (ORCPT ); Fri, 1 Apr 2016 11:51:37 -0400 Received: by mail-pa0-f46.google.com with SMTP id td3so93505304pab.2 for ; Fri, 01 Apr 2016 08:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ObmgGPdm8Jhoudl0Bg6T+Nz4ezSXvf+qEzsYrdi8AzA=; b=UGCIWPqYDZPJ8gopNevxx3j/B0/3OhFJZ59Qhwfog/bTrow/Eqw/Nqe5WP6A6ynpuR fwI1utoTM2OlD1z8rEV0mjNyc3LVRpNH8WP6PSxLEf0MXYByt00byjpkvZkAdWMm4bKH ji3MTAyafD+4jR/v49PQstIZAcu1hp/+Tn2DQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ObmgGPdm8Jhoudl0Bg6T+Nz4ezSXvf+qEzsYrdi8AzA=; b=AQekGZS8R4JVs561xh3kQuEwAufYySX3vZvcW+ebR1qb9sPvuSa0wPoMn8LAITFZGR 3ktfR9+/tveESCmjjykGvd7Qqfv4v5TJU0kSML6PkvjTcsWlYueXMCMuDSWv8Y72XjI0 UZY9G765sinyOjtXBJg6ZtRfkneppn6XXv3WikODHq4L+UWgeBOvmdTCNRFcfqipBXpY 7UaDXH1t6Sp4D7ES2yMA6iHnIjce0Umi9N9nt20/MajLcQihc4rAqDRPfIH4/HbKY2HZ kq2GK9BsJSUU15uWBKWZlhlSdDokCS6hI8maX24SFoc5l6BSG7jPe1oCOPURID8ZhIUa FGag== X-Gm-Message-State: AD7BkJKuWKg8axD2vdByAsHo3gxKhsqlOc56wL8hajac4RWdNW3ImPebvCPYGT4kUAaZbjcU X-Received: by 10.67.3.67 with SMTP id bu3mr31802417pad.39.1459525896320; Fri, 01 Apr 2016 08:51:36 -0700 (PDT) Received: from localhost.localdomain ([167.160.116.218]) by smtp.gmail.com with ESMTPSA id yj1sm22536791pac.16.2016.04.01.08.51.27 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 01 Apr 2016 08:51:34 -0700 (PDT) From: Shannon Zhao To: linux-arm-kernel@lists.infradead.org, stefano.stabellini@citrix.com Cc: david.vrabel@citrix.com, devicetree@vger.kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, julien.grall@arm.com, peter.huangpeng@huawei.com, xen-devel@lists.xen.org, zhaoshenglong@huawei.com, shannon.zhao@linaro.org Subject: [PATCH v10 14/17] XEN: EFI: Move x86 specific codes to architecture directory Date: Fri, 1 Apr 2016 23:49:12 +0800 Message-Id: <1459525755-36968-15-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1459525755-36968-1-git-send-email-shannon.zhao@linaro.org> References: <1459525755-36968-1-git-send-email-shannon.zhao@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move x86 specific codes to architecture directory and export those EFI runtime service functions. This will be useful for initializing runtime service on ARM later. Signed-off-by: Shannon Zhao Reviewed-by: Stefano Stabellini --- arch/x86/xen/efi.c | 112 ++++++++++++++++++++++++++++++++ drivers/xen/efi.c | 174 ++++++++++---------------------------------------- include/xen/xen-ops.h | 30 ++++++--- 3 files changed, 168 insertions(+), 148 deletions(-) -- 2.1.4 diff --git a/arch/x86/xen/efi.c b/arch/x86/xen/efi.c index be14cc3..86527f1 100644 --- a/arch/x86/xen/efi.c +++ b/arch/x86/xen/efi.c @@ -20,10 +20,122 @@ #include #include +#include #include +#include #include #include +#include + +static efi_char16_t vendor[100] __initdata; + +static efi_system_table_t efi_systab_xen __initdata = { + .hdr = { + .signature = EFI_SYSTEM_TABLE_SIGNATURE, + .revision = 0, /* Initialized later. */ + .headersize = 0, /* Ignored by Linux Kernel. */ + .crc32 = 0, /* Ignored by Linux Kernel. */ + .reserved = 0 + }, + .fw_vendor = EFI_INVALID_TABLE_ADDR, /* Initialized later. */ + .fw_revision = 0, /* Initialized later. */ + .con_in_handle = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ + .con_in = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ + .con_out_handle = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ + .con_out = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ + .stderr_handle = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ + .stderr = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ + .runtime = (efi_runtime_services_t *)EFI_INVALID_TABLE_ADDR, + /* Not used under Xen. */ + .boottime = (efi_boot_services_t *)EFI_INVALID_TABLE_ADDR, + /* Not used under Xen. */ + .nr_tables = 0, /* Initialized later. */ + .tables = EFI_INVALID_TABLE_ADDR /* Initialized later. */ +}; + +static const struct efi efi_xen __initconst = { + .systab = NULL, /* Initialized later. */ + .runtime_version = 0, /* Initialized later. */ + .mps = EFI_INVALID_TABLE_ADDR, + .acpi = EFI_INVALID_TABLE_ADDR, + .acpi20 = EFI_INVALID_TABLE_ADDR, + .smbios = EFI_INVALID_TABLE_ADDR, + .smbios3 = EFI_INVALID_TABLE_ADDR, + .sal_systab = EFI_INVALID_TABLE_ADDR, + .boot_info = EFI_INVALID_TABLE_ADDR, + .hcdp = EFI_INVALID_TABLE_ADDR, + .uga = EFI_INVALID_TABLE_ADDR, + .uv_systab = EFI_INVALID_TABLE_ADDR, + .fw_vendor = EFI_INVALID_TABLE_ADDR, + .runtime = EFI_INVALID_TABLE_ADDR, + .config_table = EFI_INVALID_TABLE_ADDR, + .get_time = xen_efi_get_time, + .set_time = xen_efi_set_time, + .get_wakeup_time = xen_efi_get_wakeup_time, + .set_wakeup_time = xen_efi_set_wakeup_time, + .get_variable = xen_efi_get_variable, + .get_next_variable = xen_efi_get_next_variable, + .set_variable = xen_efi_set_variable, + .query_variable_info = xen_efi_query_variable_info, + .update_capsule = xen_efi_update_capsule, + .query_capsule_caps = xen_efi_query_capsule_caps, + .get_next_high_mono_count = xen_efi_get_next_high_mono_count, + .reset_system = NULL, /* Functionality provided by Xen. */ + .set_virtual_address_map = NULL, /* Not used under Xen. */ + .memmap = NULL, /* Not used under Xen. */ + .flags = 0 /* Initialized later. */ +}; + +static efi_system_table_t __init *xen_efi_probe(void) +{ + struct xen_platform_op op = { + .cmd = XENPF_firmware_info, + .u.firmware_info = { + .type = XEN_FW_EFI_INFO, + .index = XEN_FW_EFI_CONFIG_TABLE + } + }; + union xenpf_efi_info *info = &op.u.firmware_info.u.efi_info; + + if (!xen_initial_domain() || HYPERVISOR_platform_op(&op) < 0) + return NULL; + + /* Here we know that Xen runs on EFI platform. */ + + efi = efi_xen; + + efi_systab_xen.tables = info->cfg.addr; + efi_systab_xen.nr_tables = info->cfg.nent; + + op.cmd = XENPF_firmware_info; + op.u.firmware_info.type = XEN_FW_EFI_INFO; + op.u.firmware_info.index = XEN_FW_EFI_VENDOR; + info->vendor.bufsz = sizeof(vendor); + set_xen_guest_handle(info->vendor.name, vendor); + + if (HYPERVISOR_platform_op(&op) == 0) { + efi_systab_xen.fw_vendor = __pa_symbol(vendor); + efi_systab_xen.fw_revision = info->vendor.revision; + } else + efi_systab_xen.fw_vendor = __pa_symbol(L"UNKNOWN"); + + op.cmd = XENPF_firmware_info; + op.u.firmware_info.type = XEN_FW_EFI_INFO; + op.u.firmware_info.index = XEN_FW_EFI_VERSION; + + if (HYPERVISOR_platform_op(&op) == 0) + efi_systab_xen.hdr.revision = info->version; + + op.cmd = XENPF_firmware_info; + op.u.firmware_info.type = XEN_FW_EFI_INFO; + op.u.firmware_info.index = XEN_FW_EFI_RT_VERSION; + + if (HYPERVISOR_platform_op(&op) == 0) + efi.runtime_version = info->version; + + return &efi_systab_xen; +} void __init xen_efi_init(void) { diff --git a/drivers/xen/efi.c b/drivers/xen/efi.c index be7e56a..22f71ff 100644 --- a/drivers/xen/efi.c +++ b/drivers/xen/efi.c @@ -38,7 +38,7 @@ #define efi_data(op) (op.u.efi_runtime_call) -static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) +efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) { struct xen_platform_op op = INIT_EFI_OP(get_time); @@ -59,8 +59,9 @@ static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) return efi_data(op).status; } +EXPORT_SYMBOL_GPL(xen_efi_get_time); -static efi_status_t xen_efi_set_time(efi_time_t *tm) +efi_status_t xen_efi_set_time(efi_time_t *tm) { struct xen_platform_op op = INIT_EFI_OP(set_time); @@ -72,10 +73,10 @@ static efi_status_t xen_efi_set_time(efi_time_t *tm) return efi_data(op).status; } +EXPORT_SYMBOL_GPL(xen_efi_set_time); -static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, - efi_bool_t *pending, - efi_time_t *tm) +efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, + efi_time_t *tm) { struct xen_platform_op op = INIT_EFI_OP(get_wakeup_time); @@ -95,8 +96,9 @@ static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, return efi_data(op).status; } +EXPORT_SYMBOL_GPL(xen_efi_get_wakeup_time); -static efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) +efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) { struct xen_platform_op op = INIT_EFI_OP(set_wakeup_time); @@ -113,12 +115,11 @@ static efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) return efi_data(op).status; } +EXPORT_SYMBOL_GPL(xen_efi_set_wakeup_time); -static efi_status_t xen_efi_get_variable(efi_char16_t *name, - efi_guid_t *vendor, - u32 *attr, - unsigned long *data_size, - void *data) +efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, + u32 *attr, unsigned long *data_size, + void *data) { struct xen_platform_op op = INIT_EFI_OP(get_variable); @@ -138,10 +139,11 @@ static efi_status_t xen_efi_get_variable(efi_char16_t *name, return efi_data(op).status; } +EXPORT_SYMBOL_GPL(xen_efi_get_variable); -static efi_status_t xen_efi_get_next_variable(unsigned long *name_size, - efi_char16_t *name, - efi_guid_t *vendor) +efi_status_t xen_efi_get_next_variable(unsigned long *name_size, + efi_char16_t *name, + efi_guid_t *vendor) { struct xen_platform_op op = INIT_EFI_OP(get_next_variable_name); @@ -161,12 +163,11 @@ static efi_status_t xen_efi_get_next_variable(unsigned long *name_size, return efi_data(op).status; } +EXPORT_SYMBOL_GPL(xen_efi_get_next_variable); -static efi_status_t xen_efi_set_variable(efi_char16_t *name, - efi_guid_t *vendor, - u32 attr, - unsigned long data_size, - void *data) +efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, + u32 attr, unsigned long data_size, + void *data) { struct xen_platform_op op = INIT_EFI_OP(set_variable); @@ -183,11 +184,11 @@ static efi_status_t xen_efi_set_variable(efi_char16_t *name, return efi_data(op).status; } +EXPORT_SYMBOL_GPL(xen_efi_set_variable); -static efi_status_t xen_efi_query_variable_info(u32 attr, - u64 *storage_space, - u64 *remaining_space, - u64 *max_variable_size) +efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, + u64 *remaining_space, + u64 *max_variable_size) { struct xen_platform_op op = INIT_EFI_OP(query_variable_info); @@ -205,8 +206,9 @@ static efi_status_t xen_efi_query_variable_info(u32 attr, return efi_data(op).status; } +EXPORT_SYMBOL_GPL(xen_efi_query_variable_info); -static efi_status_t xen_efi_get_next_high_mono_count(u32 *count) +efi_status_t xen_efi_get_next_high_mono_count(u32 *count) { struct xen_platform_op op = INIT_EFI_OP(get_next_high_monotonic_count); @@ -217,10 +219,10 @@ static efi_status_t xen_efi_get_next_high_mono_count(u32 *count) return efi_data(op).status; } +EXPORT_SYMBOL_GPL(xen_efi_get_next_high_mono_count); -static efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, - unsigned long count, - unsigned long sg_list) +efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, + unsigned long count, unsigned long sg_list) { struct xen_platform_op op = INIT_EFI_OP(update_capsule); @@ -237,11 +239,11 @@ static efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, return efi_data(op).status; } +EXPORT_SYMBOL_GPL(xen_efi_update_capsule); -static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, - unsigned long count, - u64 *max_size, - int *reset_type) +efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, + unsigned long count, u64 *max_size, + int *reset_type) { struct xen_platform_op op = INIT_EFI_OP(query_capsule_capabilities); @@ -260,112 +262,4 @@ static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, return efi_data(op).status; } - -static efi_char16_t vendor[100] __initdata; - -static efi_system_table_t efi_systab_xen __initdata = { - .hdr = { - .signature = EFI_SYSTEM_TABLE_SIGNATURE, - .revision = 0, /* Initialized later. */ - .headersize = 0, /* Ignored by Linux Kernel. */ - .crc32 = 0, /* Ignored by Linux Kernel. */ - .reserved = 0 - }, - .fw_vendor = EFI_INVALID_TABLE_ADDR, /* Initialized later. */ - .fw_revision = 0, /* Initialized later. */ - .con_in_handle = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ - .con_in = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ - .con_out_handle = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ - .con_out = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ - .stderr_handle = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ - .stderr = EFI_INVALID_TABLE_ADDR, /* Not used under Xen. */ - .runtime = (efi_runtime_services_t *)EFI_INVALID_TABLE_ADDR, - /* Not used under Xen. */ - .boottime = (efi_boot_services_t *)EFI_INVALID_TABLE_ADDR, - /* Not used under Xen. */ - .nr_tables = 0, /* Initialized later. */ - .tables = EFI_INVALID_TABLE_ADDR /* Initialized later. */ -}; - -static const struct efi efi_xen __initconst = { - .systab = NULL, /* Initialized later. */ - .runtime_version = 0, /* Initialized later. */ - .mps = EFI_INVALID_TABLE_ADDR, - .acpi = EFI_INVALID_TABLE_ADDR, - .acpi20 = EFI_INVALID_TABLE_ADDR, - .smbios = EFI_INVALID_TABLE_ADDR, - .smbios3 = EFI_INVALID_TABLE_ADDR, - .sal_systab = EFI_INVALID_TABLE_ADDR, - .boot_info = EFI_INVALID_TABLE_ADDR, - .hcdp = EFI_INVALID_TABLE_ADDR, - .uga = EFI_INVALID_TABLE_ADDR, - .uv_systab = EFI_INVALID_TABLE_ADDR, - .fw_vendor = EFI_INVALID_TABLE_ADDR, - .runtime = EFI_INVALID_TABLE_ADDR, - .config_table = EFI_INVALID_TABLE_ADDR, - .get_time = xen_efi_get_time, - .set_time = xen_efi_set_time, - .get_wakeup_time = xen_efi_get_wakeup_time, - .set_wakeup_time = xen_efi_set_wakeup_time, - .get_variable = xen_efi_get_variable, - .get_next_variable = xen_efi_get_next_variable, - .set_variable = xen_efi_set_variable, - .query_variable_info = xen_efi_query_variable_info, - .update_capsule = xen_efi_update_capsule, - .query_capsule_caps = xen_efi_query_capsule_caps, - .get_next_high_mono_count = xen_efi_get_next_high_mono_count, - .reset_system = NULL, /* Functionality provided by Xen. */ - .set_virtual_address_map = NULL, /* Not used under Xen. */ - .memmap = NULL, /* Not used under Xen. */ - .flags = 0 /* Initialized later. */ -}; - -efi_system_table_t __init *xen_efi_probe(void) -{ - struct xen_platform_op op = { - .cmd = XENPF_firmware_info, - .u.firmware_info = { - .type = XEN_FW_EFI_INFO, - .index = XEN_FW_EFI_CONFIG_TABLE - } - }; - union xenpf_efi_info *info = &op.u.firmware_info.u.efi_info; - - if (!xen_initial_domain() || HYPERVISOR_platform_op(&op) < 0) - return NULL; - - /* Here we know that Xen runs on EFI platform. */ - - efi = efi_xen; - - efi_systab_xen.tables = info->cfg.addr; - efi_systab_xen.nr_tables = info->cfg.nent; - - op.cmd = XENPF_firmware_info; - op.u.firmware_info.type = XEN_FW_EFI_INFO; - op.u.firmware_info.index = XEN_FW_EFI_VENDOR; - info->vendor.bufsz = sizeof(vendor); - set_xen_guest_handle(info->vendor.name, vendor); - - if (HYPERVISOR_platform_op(&op) == 0) { - efi_systab_xen.fw_vendor = __pa_symbol(vendor); - efi_systab_xen.fw_revision = info->vendor.revision; - } else - efi_systab_xen.fw_vendor = __pa_symbol(L"UNKNOWN"); - - op.cmd = XENPF_firmware_info; - op.u.firmware_info.type = XEN_FW_EFI_INFO; - op.u.firmware_info.index = XEN_FW_EFI_VERSION; - - if (HYPERVISOR_platform_op(&op) == 0) - efi_systab_xen.hdr.revision = info->version; - - op.cmd = XENPF_firmware_info; - op.u.firmware_info.type = XEN_FW_EFI_INFO; - op.u.firmware_info.index = XEN_FW_EFI_RT_VERSION; - - if (HYPERVISOR_platform_op(&op) == 0) - efi.runtime_version = info->version; - - return &efi_systab_xen; -} +EXPORT_SYMBOL_GPL(xen_efi_query_capsule_caps); diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h index 072be1c..3491582 100644 --- a/include/xen/xen-ops.h +++ b/include/xen/xen-ops.h @@ -90,14 +90,28 @@ int xen_xlate_map_ballooned_pages(xen_pfn_t **pfns, void **vaddr, bool xen_running_on_version_or_later(unsigned int major, unsigned int minor); -#ifdef CONFIG_XEN_EFI -extern efi_system_table_t *xen_efi_probe(void); -#else -static inline efi_system_table_t __init *xen_efi_probe(void) -{ - return NULL; -} -#endif +efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc); +efi_status_t xen_efi_set_time(efi_time_t *tm); +efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, + efi_time_t *tm); +efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm); +efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, + u32 *attr, unsigned long *data_size, + void *data); +efi_status_t xen_efi_get_next_variable(unsigned long *name_size, + efi_char16_t *name, efi_guid_t *vendor); +efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, + u32 attr, unsigned long data_size, + void *data); +efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, + u64 *remaining_space, + u64 *max_variable_size); +efi_status_t xen_efi_get_next_high_mono_count(u32 *count); +efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, + unsigned long count, unsigned long sg_list); +efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, + unsigned long count, u64 *max_size, + int *reset_type); #ifdef CONFIG_PREEMPT