From patchwork Tue Apr 9 15:05:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Luis X-Patchwork-Id: 787257 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0EBB131197; Tue, 9 Apr 2024 15:07:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712675236; cv=none; b=RUQGYJ9PzALa1KrOBh1IOFxNbmoj4NfkB/OWE2LBb8BicmoATtNVPfQn8cPcw3RUsHCOUb1+6699pvUfiNfmT+ouTd3SiAjq9zqWOxybNr4TQasg2pf7qQc4b32VsVWyvL3HgB12j7LSZn4HHaXWIj7HGKCFaQ+9mhB4CuNjXTA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712675236; c=relaxed/simple; bh=v5X5ay6bRK+RfiHpqY5h3r7grwaUPVO4lbpVntbmqDU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AfFj66Zs0lUsYJm092qPajjWQqdK3WGIHg9kjKSJA1ydmzyDk6tyZsPO3qrahmGfE1UyHA4BpoEyQSgscZyEugFtks3LPaQ4fHHNkI4t6t1RWNfB767Xf73syAkSE72xv/pmHUGqgoCIaznTF5IfO7Rhi5G0MkXWrk36/86LKIU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=QNzkMCcP; arc=none smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="QNzkMCcP" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 439BYUNw005163; Tue, 9 Apr 2024 15:06:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : reply-to : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=6flji1xebiuIQY9vm5RGgAnfjZP82r1pWe547+YkqOg=; b=QNzkMCcPeALhqCrdV0T6bUBT2tVpKsxJ6Ov4SyddO3XnULP/CNyw0OMvJRGFjA2gnfhX psW94vCPL1ku4AcMljfuh08QnnofpEB8GtY87o8jUnIFrpgEXlzV8h23Nls/+a60x6e7 XPb0M/HXTGyGtSQ9uz8rAB7uB8E9mBK0syRuyPEhp0JbpUEW9I0Pds+ThukBtb7R7gDm iAGtqLi9S206f+J8yLoZF9v0yFEr4gAEjyS/bxSc5ZbWh4VnETTz3dGem0flGyDxU703 qUaJ6LrFTmDAr92UApL28a4i4XLxuAV5sNxASWG63j0tQ/h/gM4KlF6vF8ZPpNB0dxUb +Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xaw0258vq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 09 Apr 2024 15:06:58 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 439DtccH040068; Tue, 9 Apr 2024 15:06:57 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xavud47qb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 09 Apr 2024 15:06:57 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 439F1w6k031745; Tue, 9 Apr 2024 15:06:57 GMT Received: from mlluis-mac.nl.oracle.com (dhcp-10-175-24-232.vpn.oracle.com [10.175.24.232]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3xavud47d2-2; Tue, 09 Apr 2024 15:06:56 +0000 From: Miguel Luis To: Jonathan.Cameron@Huawei.com, "Rafael J. Wysocki" , Len Brown , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: rmk+kernel@armlinux.org.uk, miguel.luis@oracle.com Subject: [RFC PATCH 1/4] ACPI: processor: refactor acpi_processor_get_info: evaluation of processor declaration Date: Tue, 9 Apr 2024 15:05:30 +0000 Message-ID: <20240409150536.9933-2-miguel.luis@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240409150536.9933-1-miguel.luis@oracle.com> References: <20240409150536.9933-1-miguel.luis@oracle.com> Reply-To: miguel.luis@oracle.com Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-09_10,2024-04-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404090099 X-Proofpoint-ORIG-GUID: qk7BfKjnExLtSngZjCVAuzkZF39q4ij3 X-Proofpoint-GUID: qk7BfKjnExLtSngZjCVAuzkZF39q4ij3 Isolate the evaluation of processor declaration into its own function. No functional changes. Signed-off-by: Miguel Luis --- drivers/acpi/acpi_processor.c | 78 +++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 27 deletions(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 7a0dd35d62c9..37e8b69113dd 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -230,15 +230,59 @@ static inline int acpi_processor_hotadd_init(struct acpi_processor *pr) } #endif /* CONFIG_ACPI_HOTPLUG_CPU */ +static int acpi_evaluate_processor(struct acpi_device *device, + struct acpi_processor *pr, + union acpi_object *object, + int *device_declaration) +{ + struct acpi_buffer buffer = { sizeof(union acpi_object), object }; + acpi_status status = AE_OK; + unsigned long long value; + + /* + * Declarations via the ASL "Processor" statement are deprecated. + */ + if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) { + /* Declared with "Processor" statement; match ProcessorID */ + status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); + if (ACPI_FAILURE(status)) { + dev_err(&device->dev, + "Failed to evaluate processor object (0x%x)\n", + status); + return -ENODEV; + } + + value = object->processor.proc_id; + goto out; + } + + /* + * Declared with "Device" statement; match _UID. + */ + status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID, + NULL, &value); + if (ACPI_FAILURE(status)) { + dev_err(&device->dev, + "Failed to evaluate processor _UID (0x%x)\n", + status); + return -ENODEV; + } + + *device_declaration = 1; +out: + pr->acpi_id = value; + return 0; +} + static int acpi_processor_get_info(struct acpi_device *device) { union acpi_object object = { 0 }; - struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; struct acpi_processor *pr = acpi_driver_data(device); int device_declaration = 0; acpi_status status = AE_OK; static int cpu0_initialized; unsigned long long value; + int ret; acpi_processor_errata(); @@ -252,32 +296,12 @@ static int acpi_processor_get_info(struct acpi_device *device) } else dev_dbg(&device->dev, "No bus mastering arbitration control\n"); - if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) { - /* Declared with "Processor" statement; match ProcessorID */ - status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); - if (ACPI_FAILURE(status)) { - dev_err(&device->dev, - "Failed to evaluate processor object (0x%x)\n", - status); - return -ENODEV; - } - - pr->acpi_id = object.processor.proc_id; - } else { - /* - * Declared with "Device" statement; match _UID. - */ - status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID, - NULL, &value); - if (ACPI_FAILURE(status)) { - dev_err(&device->dev, - "Failed to evaluate processor _UID (0x%x)\n", - status); - return -ENODEV; - } - device_declaration = 1; - pr->acpi_id = value; - } + /* + * Evaluate processor declaration. + */ + ret = acpi_evaluate_processor(device, pr, &object, &device_declaration); + if (ret) + return ret; if (acpi_duplicate_processor_id(pr->acpi_id)) { if (pr->acpi_id == 0xff) From patchwork Tue Apr 9 15:05:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Luis X-Patchwork-Id: 787544 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F5DF137C3C; Tue, 9 Apr 2024 15:07:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712675237; cv=none; b=UcfO5FXBBD6YkhPGYofFEdQFyzIgI/eYw51xgL2pRt/xM3QSzB03RjsUl+etomIJ1RYHnRPP5OfKCV2TsMs6vn2M6BIlGQB0+jMJPEBkoej/RwZpP3mK++x3R5dQpgsmHZjO6zMDIBxZJKYOc60iDl9+WihoMjp2UGO2CwJ2WxE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712675237; c=relaxed/simple; bh=GkKaCNKtD+yJTbUhmLsEYlYnm2psQdcVXTC45xfJ9qs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LBjlRMjYH2SPYneAm2VIgqI7diTXGnXWRUIfyY6U2ZCgISpSs+iMx5Xqdp2H8oHCbq6wmghRs7NOhVB5bAo78JZy4860qG705AuwLV2M3SIyONIygb5APMX1YVE/eSVUj30T+p02jXBZDV9S0RKF0vOcRRGe1t8JuSTMY5j6Euc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=UzIsA1JO; arc=none smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="UzIsA1JO" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 439BYIB6031273; Tue, 9 Apr 2024 15:07:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : reply-to : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=V6sBKvwQdVULyOl0ljTolpSlHxl8QLBq8rG46va5X5c=; b=UzIsA1JOrSprccNf9UY+IRYpXM302NPuOU3lrZ1uf0UJ3m111Obh1HePNHLegIIzg0pE 16TnOFi9jExJf7+Vf5f4yi6ESBh1AKhgbX7gWIEDV6Gr1cJc8H7DViBDzjzkr/XCmbPk 0Ki1w/uh01BWnPuh7IHk5S4gHMJSE15EAu6hcyuws5LIVpVkMZOw3QyTKo6nD1Lkg2tt SJBrScdQr5NLEXfmngmxlV9XEfaFCz27cGlBXDSjjUjdJVC7WFs5YzL3YeTh+NMRgHl4 ePbQAkG7gQyvpG1crJdhxg0oak9cPHc1ckYSpTI8g1NPfQmkuBv8R9N7Ensd7WiIojf6 Bw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xax9b56ab-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 09 Apr 2024 15:07:05 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 439DopLj040673; Tue, 9 Apr 2024 15:07:04 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xavud47v1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 09 Apr 2024 15:07:04 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 439F1w6m031745; Tue, 9 Apr 2024 15:07:04 GMT Received: from mlluis-mac.nl.oracle.com (dhcp-10-175-24-232.vpn.oracle.com [10.175.24.232]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3xavud47d2-3; Tue, 09 Apr 2024 15:07:03 +0000 From: Miguel Luis To: Jonathan.Cameron@Huawei.com, "Rafael J. Wysocki" , Len Brown , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: rmk+kernel@armlinux.org.uk, miguel.luis@oracle.com Subject: [RFC PATCH 2/4] ACPI: processor: refactor acpi_processor_get_info: isolate cpu hotpug init delay Date: Tue, 9 Apr 2024 15:05:31 +0000 Message-ID: <20240409150536.9933-3-miguel.luis@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240409150536.9933-1-miguel.luis@oracle.com> References: <20240409150536.9933-1-miguel.luis@oracle.com> Reply-To: miguel.luis@oracle.com Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-09_10,2024-04-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404090099 X-Proofpoint-GUID: cV17hYUM9voXWnUWxkkOMJip5Ea1uxhP X-Proofpoint-ORIG-GUID: cV17hYUM9voXWnUWxkkOMJip5Ea1uxhP Delaying a hotplugged CPU initialization depends on CONFIG_ACPI_HOTPLUG_CPU. Isolate that. Signed-off-by: Miguel Luis --- drivers/acpi/acpi_processor.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 37e8b69113dd..9ea58b61d741 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -184,7 +184,22 @@ static void __init acpi_pcc_cpufreq_init(void) {} /* Initialization */ #ifdef CONFIG_ACPI_HOTPLUG_CPU -static int acpi_processor_hotadd_init(struct acpi_processor *pr) +static void acpi_processor_hotplug_delay_init(struct acpi_processor *pr) +{ + /* + * CPU got hot-added, but cpu_data is not initialized yet. Set a flag + * to delay cpu_idle/throttling initialization and do it when the CPU + * gets online for the first time. + */ + pr_info("CPU%d has been hot-added\n", pr->id); + pr->flags.need_hotplug_init = 1; +} +#else +static void acpi_processor_hotplug_delay_init(struct acpi_processor *pr) {} +#endif /* CONFIG_ACPI_HOTPLUG_CPU */ + +/* Enumerate extra CPUs */ +static int acpi_processor_enumerate_extra(struct acpi_processor *pr) { unsigned long long sta; acpi_status status; @@ -210,25 +225,12 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr) goto out; } - /* - * CPU got hot-added, but cpu_data is not initialized yet. Set a flag - * to delay cpu_idle/throttling initialization and do it when the CPU - * gets online for the first time. - */ - pr_info("CPU%d has been hot-added\n", pr->id); - pr->flags.need_hotplug_init = 1; - + acpi_processor_hotplug_delay_init(pr); out: cpus_write_unlock(); cpu_maps_update_done(); return ret; } -#else -static inline int acpi_processor_hotadd_init(struct acpi_processor *pr) -{ - return -ENODEV; -} -#endif /* CONFIG_ACPI_HOTPLUG_CPU */ static int acpi_evaluate_processor(struct acpi_device *device, struct acpi_processor *pr, @@ -347,7 +349,7 @@ static int acpi_processor_get_info(struct acpi_device *device) * because cpuid <-> apicid mapping is persistent now. */ if (invalid_logical_cpuid(pr->id) || !cpu_present(pr->id)) { - int ret = acpi_processor_hotadd_init(pr); + int ret = acpi_processor_enumerate_extra(pr); if (ret) return ret; From patchwork Tue Apr 9 15:05:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Luis X-Patchwork-Id: 787256 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0E10137C3C; Tue, 9 Apr 2024 15:07:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712675246; cv=none; b=WHR2WZG38k6xJyx6v1ONA5GVZTRrIks5r414OknnPTzvLORQoGOeiHcgE2mVrFQRKnfVpzF0ZO0wNudKepb6809md1LCnk4+tEUmdc62XVVyzMJVPrw3EimnLxa6fhcutPb2bByfnj7olcaSNImJGB6CA7A01Gzg0tsMJpppkMY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712675246; c=relaxed/simple; bh=vrZ3tiCXBZGKXJNM3xzbtKkelxd/LhC9LT0HpY49ZQ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jxHMsqL7B0G1bSC2dgyiDHnccUwIJpWgVJpqjb+WK0LAyEzWpSx0dJ0riM/GcEJBrNwerwnErtWZZZ1Y16eycOTURNVtTjOxZIDTwTgU7pS2nhYYO85sDS/1sTFd0fSwIOcI4tzWx5ZSfImEZTGshvtogJrwuyV2r5Ldcbh6w8E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=KQSDXpZy; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="KQSDXpZy" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 439BXpZS027182; Tue, 9 Apr 2024 15:07:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : reply-to : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=NnciRmIwPTaAFXCbUZhNskjo3Krm+iqTOHCJRaOrZmM=; b=KQSDXpZy8Ss/FTXgpmD1LmH0eA5jlyE41KToWiaE0QgieFIJQEE6D+RHMCoF8dLtwalH rs9kMzGLLUVeN7RNU+zlteysm8PTDD2NDoN3qf/3VDvOIB8UEe10qUtabXHHOR4WCIOB 6tKKnDQiTRrRCSZ8ZKGGoQ4tI7BYo1PZS/pewQbG/jHrVUPKW6lxsOCQKAYKp6NQ+6LL nEOy/FItBB1rCkTuvoigKewCPQl9Y0hrlNWkOxa19FUO1SUvOWRC9GQybT/Bl6SA0TDo bjpFtc5JCdRkfsuVHp2ifU8+8Sc+ZmojF9dmrbuT6vmi2nELaQeboMVI8qV2cT13n+r4 dA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xavtf56wm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 09 Apr 2024 15:07:13 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 439EM5EU040105; Tue, 9 Apr 2024 15:07:12 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xavud4825-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 09 Apr 2024 15:07:12 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 439F1w6o031745; Tue, 9 Apr 2024 15:07:11 GMT Received: from mlluis-mac.nl.oracle.com (dhcp-10-175-24-232.vpn.oracle.com [10.175.24.232]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3xavud47d2-4; Tue, 09 Apr 2024 15:07:11 +0000 From: Miguel Luis To: Jonathan.Cameron@Huawei.com, "Rafael J. Wysocki" , Len Brown , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: rmk+kernel@armlinux.org.uk, miguel.luis@oracle.com Subject: [RFC PATCH 3/4] ACPI: processor: refactor acpi_processor_get_info: isolate acpi_{map|unmap}_cpu under CONFIG_ACPI_HOTPLUG_CPU Date: Tue, 9 Apr 2024 15:05:32 +0000 Message-ID: <20240409150536.9933-4-miguel.luis@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240409150536.9933-1-miguel.luis@oracle.com> References: <20240409150536.9933-1-miguel.luis@oracle.com> Reply-To: miguel.luis@oracle.com Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-09_10,2024-04-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404090099 X-Proofpoint-GUID: sdbUCffTnZ_HAFUvfazlqtPTFw5WQMTG X-Proofpoint-ORIG-GUID: sdbUCffTnZ_HAFUvfazlqtPTFw5WQMTG mapping and unmaping a cpu at the stage of extra cpu enumeration is architecture specific which depends on CONFIG_ACPI_HOTPLUG_CPU so let's isolate that functionality from architecture independent one. Signed-off-by: Miguel Luis --- drivers/acpi/acpi_processor.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 9ea58b61d741..c6e2f64a056b 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -194,8 +194,21 @@ static void acpi_processor_hotplug_delay_init(struct acpi_processor *pr) pr_info("CPU%d has been hot-added\n", pr->id); pr->flags.need_hotplug_init = 1; } +static int acpi_processor_hotplug_map_cpu(struct acpi_processor *pr) +{ + return acpi_map_cpu(pr->handle, pr->phys_id, pr->acpi_id, &pr->id); +} +static void acpi_processor_hotplug_unmap_cpu(struct acpi_processor *pr) +{ + acpi_unmap_cpu(pr->id); +} #else static void acpi_processor_hotplug_delay_init(struct acpi_processor *pr) {} +static int acpi_processor_hotplug_map_cpu(struct acpi_processor *pr) +{ + return 0; +} +static void acpi_processor_hotplug_unmap_cpu(struct acpi_processor *pr) {} #endif /* CONFIG_ACPI_HOTPLUG_CPU */ /* Enumerate extra CPUs */ @@ -215,13 +228,13 @@ static int acpi_processor_enumerate_extra(struct acpi_processor *pr) cpu_maps_update_begin(); cpus_write_lock(); - ret = acpi_map_cpu(pr->handle, pr->phys_id, pr->acpi_id, &pr->id); + ret = acpi_processor_hotplug_map_cpu(pr); if (ret) goto out; ret = arch_register_cpu(pr->id); if (ret) { - acpi_unmap_cpu(pr->id); + acpi_processor_hotplug_unmap_cpu(pr); goto out; } From patchwork Tue Apr 9 15:05:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Luis X-Patchwork-Id: 787543 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD20413C9C3; Tue, 9 Apr 2024 15:07:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712675248; cv=none; b=Gusmyndb4OXzfhUpwFwpCrPQvc6+NZzgQc+ps5OxegTUWjHrSN+UvJPPOqsRb4Lp3wiqB/qHw4bwJn2hDYT/jdethVv3qpFo0y8RRdKNtVviBsqC9XdtMdg+NuVloIvoHKTK5xxqhRKAJaDDoDS62Do6yP8VZ23liPI+uqxeOs8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712675248; c=relaxed/simple; bh=Fr/7Vk+42GlrQK5lyg4HKEM7UAJHjX9Lce4HDrPk0cQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VNB/nz7V/CoXpohIOPllN1H/9hAvSNGVE1PGwKso5sVU5SD8++wW2en4SpDf5CNOSciXTc81ZGbo7FcE4cn0Nx2tK7xNpOQ1biSNejK0Y/Va8yAbFIZU7unEDnxhtIqmDKdV5QT+mPNKNSVP593rX7R17SuUc9LANmMYa88T0ag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=YSFgDaUd; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="YSFgDaUd" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 439BXpcU027169; Tue, 9 Apr 2024 15:07:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : reply-to : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=ADojagcKuzpE+KHCFjAYBG/GaH/BcFxdSuinTPiEx78=; b=YSFgDaUd9R08vJyXaNNqHAtjImTSsrneId3SLgoaFoSEefaAajCnxnct62cVMZHEZIEH lUnAy70aOE71iG5uosjsC748KJ5uPZjkALf+rMWsj5uvy2cQjmwbay902vDOTqFzb5S7 jYlwD5o4oKfp/TVeqRixOy3qZoLCJ0xD2GqQykQs8zIhwficiR2SAhagXJEbrd1ETnGm ZfJ+DkaMrZOBe7UHBBWg61skawIoPX4GztZuZXgywNBaKtdI/vqxWNcUSY3wmhKK+E7c 4fgd9WyKh96LjcJ5kaZ3gJluwUczETjHYcVD7WLyLqI5HmrMa8gv+wbGI19pVCOFza7y Mw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xavtf56wx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 09 Apr 2024 15:07:19 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 439E5MVC039988; Tue, 9 Apr 2024 15:07:18 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xavud4870-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 09 Apr 2024 15:07:18 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 439F1w6q031745; Tue, 9 Apr 2024 15:07:18 GMT Received: from mlluis-mac.nl.oracle.com (dhcp-10-175-24-232.vpn.oracle.com [10.175.24.232]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3xavud47d2-5; Tue, 09 Apr 2024 15:07:17 +0000 From: Miguel Luis To: Jonathan.Cameron@Huawei.com, "Rafael J. Wysocki" , Len Brown , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: rmk+kernel@armlinux.org.uk, miguel.luis@oracle.com Subject: [RFC PATCH 4/4] ACPI: processor: refactor acpi_processor_remove: isolate acpi_unmap_cpu under CONFIG_ACPI_HOTPLUG_CPU Date: Tue, 9 Apr 2024 15:05:33 +0000 Message-ID: <20240409150536.9933-5-miguel.luis@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240409150536.9933-1-miguel.luis@oracle.com> References: <20240409150536.9933-1-miguel.luis@oracle.com> Reply-To: miguel.luis@oracle.com Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-09_10,2024-04-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404090099 X-Proofpoint-GUID: 4t9WjYmlI0fwn8f5L_G8oSP9tktfBByP X-Proofpoint-ORIG-GUID: 4t9WjYmlI0fwn8f5L_G8oSP9tktfBByP acpi_unmap_cpu is architecture dependent. Isolate it. The pre-processor guard for detach may now be restricted to cpu unmap. Signed-off-by: Miguel Luis --- drivers/acpi/acpi_processor.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index c6e2f64a056b..edcd6a8d4735 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -492,6 +492,14 @@ static int acpi_processor_add(struct acpi_device *device, } #ifdef CONFIG_ACPI_HOTPLUG_CPU +static void acpi_processor_hotunplug_unmap_cpu(struct acpi_processor *pr) +{ + acpi_unmap_cpu(pr->id); +} +#else +static void acpi_processor_hotunplug_unmap_cpu(struct acpi_processor *pr) {} +#endif /* CONFIG_ACPI_HOTPLUG_CPU */ + /* Removal */ static void acpi_processor_remove(struct acpi_device *device) { @@ -524,7 +532,7 @@ static void acpi_processor_remove(struct acpi_device *device) /* Remove the CPU. */ arch_unregister_cpu(pr->id); - acpi_unmap_cpu(pr->id); + acpi_processor_hotunplug_unmap_cpu(pr); cpus_write_unlock(); cpu_maps_update_done(); @@ -535,7 +543,6 @@ static void acpi_processor_remove(struct acpi_device *device) free_cpumask_var(pr->throttling.shared_cpu_map); kfree(pr); } -#endif /* CONFIG_ACPI_HOTPLUG_CPU */ #ifdef CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC bool __init processor_physically_present(acpi_handle handle) @@ -660,9 +667,7 @@ static const struct acpi_device_id processor_device_ids[] = { static struct acpi_scan_handler processor_handler = { .ids = processor_device_ids, .attach = acpi_processor_add, -#ifdef CONFIG_ACPI_HOTPLUG_CPU .detach = acpi_processor_remove, -#endif .hotplug = { .enabled = true, },