Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp382034rdb; Sat, 19 Aug 2023 05:45:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHY+UUIaju44LNRq701Kgh/RjCIZWfFLD0J/4HDSlz+KmIBU5NpYbcVI6zzFU4XCkgsuxZF X-Received: by 2002:a17:90a:9a8:b0:26d:40ec:3cf3 with SMTP id 37-20020a17090a09a800b0026d40ec3cf3mr1850613pjo.0.1692449141834; Sat, 19 Aug 2023 05:45:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692449141; cv=none; d=google.com; s=arc-20160816; b=WDLcxSgp5vXNQsExLmBy2rVjJTmCUmo3vQbl5/Q+pc/yX9KQedMyJw5Axe0qFTeMbT dGGBqFnrUnlodzVfve5IkGdhXjbjjWiL7W8ldbEQhxfJiym9E1cG+JAC6Ma7udEqdfZw lG2XSZnCPPD1b7sV4JDiHqLwzmfh2B974c+Zt8earxt46gQJKzQS6WXgtS0gGejm/LqX Z6TISfrAKaml8i/jld4MrkDrmQpMHApD6NlNYjvvl2aJUw4mNEpg8N4Z+YGNll0Odjad zMqSQR1KmnI1BQJEjp/Tsnj/scUg1e69vjcYTe+rrglBLXL0sJ6gGUwKSRq5Dsc/Q6Lw PxwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=04S5iAJzEduZzKdxwMDLV+wI9WaagbWOSfJSTsrvX8M=; fh=u5JA2CgbM186VCnTHmuNI9HoXohp8VS80I/+4lERFtk=; b=zEJo5AMPC68N/4k/P7qUl+wTXl0PqktWJE3qmS2hYI5BBJzNAuHj4QxovzFvFTUZbv 5AiwLplvDUJIQh+WNltkDWwehTablpDCZXeWppQSRbc7zY/NJZRhzSZ485cn26O3/Pe2 1P+XnNTQHSXvoGaM5oDgKbhovDNVUvQKWYs8tD4RPmbFvUk850YXUdzjqQg88v4H/CC6 +V6+BkZp3yWFp0OEGdwlchdFFQF1Co4JOn1b47E+O7dHXlkYmxnRkPjWNqOw7BuY30fy v1S7tSIScK9PtLo/+cKs4642Bxt0OEo3T5IbJrnFBioNgyEhUOUJ/A5yWqtlyyCX2qJq USdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id pc8-20020a17090b3b8800b00263c48abf8asi5608906pjb.31.2023.08.19.05.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 05:45:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 65BDB8C072; Sat, 19 Aug 2023 01:38:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357888AbjHRGEC (ORCPT + 99 others); Fri, 18 Aug 2023 02:04:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357717AbjHRGDz (ORCPT ); Fri, 18 Aug 2023 02:03:55 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4599030E1; Thu, 17 Aug 2023 23:03:51 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.170]) by gateway (Coremail) with SMTP id _____8BxuOjFCd9kh8wZAA--.17256S3; Fri, 18 Aug 2023 14:03:50 +0800 (CST) Received: from [10.20.42.170] (unknown [10.20.42.170]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxriPFCd9kk2ldAA--.57484S3; Fri, 18 Aug 2023 14:03:49 +0800 (CST) Message-ID: <175ba9b3-d667-f887-e04c-f19ad15a57e4@loongson.cn> Date: Fri, 18 Aug 2023 14:03:49 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2] ACPI: processor_core: LoongArch: Get physical id from MADT table To: "Rafael J. Wysocki" Cc: Len Brown , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230717022258.2579631-1-maobibo@loongson.cn> Content-Language: en-US From: bibo mao In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8CxriPFCd9kk2ldAA--.57484S3 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoWxZw18WrW5trW8Cw47Aw4kZrc_yoW5Zw4kpF y8Ka4Yk3WUWF12gw1Sq3WYgFyFv3y8Ca4fWFs7Gry3K3ZYkryfXFWUXryagryUAF4Fk3y0 vr1UtFZrWFWFvFgCm3ZEXasCq-sJn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUvFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6r4UJVWxJr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27w Aqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE 14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvEwIxGrwCYjI0SjxkI62AI1c AE67vIY487MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8C rVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtw CIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x02 67AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr 0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxUrNtx DUUUU X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2023/8/18 00:40, Rafael J. Wysocki 写道: > On Tue, Jul 25, 2023 at 2:32 AM bibo mao wrote: >> >> slightly ping :) >> >> 在 2023/7/17 10:22, Bibo Mao 写道: >>> With ACPI Spec 6.5 chapter 5.2.12.20, each processor in LoongArch >>> system has a Core Programmable Interrupt Controller in MADT table, >>> value of its type is 0x11 in the spec and defined as enum variable >>> ACPI_MADT_TYPE_CORE_PIC in Linux kernel. Physical id can be parsed >>> from MADT table for LoongArch system, also it can be parsed from >>> MAT table for hotplug cpu. This patch adds physical id parsing for >>> LoongArch system. >>> >>> Signed-off-by: Bibo Mao >>> --- >>> Changes in v2: >>> Refresh the changelog and add detailed description of acpi spec >>> about MADT table for LoongArch system. >>> >>> Add comments in function map_core_pic_id. >>> >>> --- >>> drivers/acpi/processor_core.c | 29 +++++++++++++++++++++++++++++ >>> 1 file changed, 29 insertions(+) >>> >>> diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c >>> index d6606a9f2da6..7dd6dbaa98c3 100644 >>> --- a/drivers/acpi/processor_core.c >>> +++ b/drivers/acpi/processor_core.c >>> @@ -132,6 +132,30 @@ static int map_rintc_hartid(struct acpi_subtable_header *entry, >>> return -EINVAL; >>> } >>> >>> +/* >>> + * Retrieve LoongArch CPU physical id >>> + */ >>> +static int map_core_pic_id(struct acpi_subtable_header *entry, >>> + int device_declaration, u32 acpi_id, phys_cpuid_t *phys_id) >>> +{ >>> + struct acpi_madt_core_pic *core_pic = >>> + container_of(entry, struct acpi_madt_core_pic, header); >>> + >>> + if (!(core_pic->flags & ACPI_MADT_ENABLED)) >>> + return -ENODEV; >>> + >>> + /* device_declaration means Device object in DSDT, in LoongArch >>> + * system, logical processor acpi_id is required in _UID property >>> + * of DSDT table, so we should check device_declaration here >>> + */ >>> + if (device_declaration && (core_pic->processor_id == acpi_id)) { >>> + *phys_id = core_pic->core_id; >>> + return 0; >>> + } >>> + >>> + return -EINVAL; >>> +} >>> + >>> static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt, >>> int type, u32 acpi_id) >>> { >>> @@ -165,6 +189,9 @@ static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt, >>> } else if (header->type == ACPI_MADT_TYPE_RINTC) { >>> if (!map_rintc_hartid(header, type, acpi_id, &phys_id)) >>> break; >>> + } else if (header->type == ACPI_MADT_TYPE_CORE_PIC) { >>> + if (!map_core_pic_id(header, type, acpi_id, &phys_id)) >>> + break; >>> } >>> entry += header->length; >>> } >>> @@ -216,6 +243,8 @@ static phys_cpuid_t map_mat_entry(acpi_handle handle, int type, u32 acpi_id) >>> map_x2apic_id(header, type, acpi_id, &phys_id); >>> else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) >>> map_gicc_mpidr(header, type, acpi_id, &phys_id); >>> + else if (header->type == ACPI_MADT_TYPE_CORE_PIC) >>> + map_core_pic_id(header, type, acpi_id, &phys_id); >>> >>> exit: >>> kfree(buffer.pointer); >> > > Sorry for the delay. > > Applied (under a slightly edited subject) as 6.6 material, thanks! Thanks for applying the patch.