Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp276568pxb; Fri, 16 Apr 2021 05:32:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAVfr9NaeiJVUuVsD5xHxhNliOtlDEZjgwO8imtP+3sbKjycQ/X58LcH2Noc8JFP+/eXgW X-Received: by 2002:aa7:cc03:: with SMTP id q3mr9826187edt.366.1618576345257; Fri, 16 Apr 2021 05:32:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618576345; cv=none; d=google.com; s=arc-20160816; b=VxFotu5voEeTJ7b7lliYk7Qxr2OWYkkJIZcUw3SFCZoD0sF4FWoVBNLVOxdbiv4fuR YwxTpaLnFTfDGt7MGL/3dS+H3XRN3eyuPa4IETpegfb/y7sDWQTx2VCmbSviko99GDLw RN5FbpBrSGwbcA2LJvu7ZaPWPty+rNzXAzUzWcAskC3w43JCBWY4Zs+CNrT8EF18CvfT syStIrzA0tXISGoLd3ly3FflugYKcCYjMPPR92c4X2jeGjZLjeVYy64fzKKk37q9fRtK be/qtbPYu/C+whPZ7/HFLPpnBY+nVzOhAPJJTJKGiylzpTJVhGiy1A6JWI7Dop8eu4Uo K3xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=18ruHON27oR+kY/c3N8I4MzJXO+YsiN8w2GDZFpsARM=; b=nVq6sBTDK1MRNuu64D4Kktg4tICBIkOBBBWMx5YchZeVbYMMPp1pOTGN4UkK5eq1pY s1XGKMJQB6Qgb/11cyL3iywJLzjUwElkaYLuRKDZgjCXVfTL8gX+cUz9yVzl/OOVtjZI SsUkjxzHCL6e84uJetAXmyRpZG7ApE2yXSRZpvRv+OBvsPnTqRlcqq7xwB/KIohRWJAi k5og5SyEUt4o1H54qIWkAddVi0Vu1u6Rb4YtcqTgN6dgmxZtM1ZtqSfQiwgW3Ec2j9HV BTRfrhZKy+Wa8tFt9tPLuqfcKSdCFzGbcTHqufD7+M/yED43ufx+ce+6Y1DU1YlPZcxk UfgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j9si4150983edp.96.2021.04.16.05.32.01; Fri, 16 Apr 2021 05:32:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242664AbhDPLZC (ORCPT + 99 others); Fri, 16 Apr 2021 07:25:02 -0400 Received: from mx2.suse.de ([195.135.220.15]:48706 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235011AbhDPLYu (ORCPT ); Fri, 16 Apr 2021 07:24:50 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8D50AB01C; Fri, 16 Apr 2021 11:24:25 +0000 (UTC) From: Oscar Salvador To: Andrew Morton Cc: David Hildenbrand , Michal Hocko , Anshuman Khandual , Pavel Tatashin , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador , Michal Hocko Subject: [PATCH v9 5/8] acpi,memhotplug: Enable MHP_MEMMAP_ON_MEMORY when supported Date: Fri, 16 Apr 2021 13:24:08 +0200 Message-Id: <20210416112411.9826-6-osalvador@suse.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210416112411.9826-1-osalvador@suse.de> References: <20210416112411.9826-1-osalvador@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Let the caller check whether it can pass MHP_MEMMAP_ON_MEMORY by checking mhp_supports_memmap_on_memory(). MHP_MEMMAP_ON_MEMORY can only be set in case ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE is enabled, the architecture supports altmap, and the range to be added spans a single memory block. Signed-off-by: Oscar Salvador Reviewed-by: David Hildenbrand Acked-by: Michal Hocko --- drivers/acpi/acpi_memhotplug.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index b02fd51e5589..8cc195c4c861 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -171,6 +171,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) acpi_handle handle = mem_device->device->handle; int result, num_enabled = 0; struct acpi_memory_info *info; + mhp_t mhp_flags = MHP_NONE; int node; node = acpi_get_node(handle); @@ -194,8 +195,10 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) if (node < 0) node = memory_add_physaddr_to_nid(info->start_addr); + if (mhp_supports_memmap_on_memory(info->length)) + mhp_flags |= MHP_MEMMAP_ON_MEMORY; result = __add_memory(node, info->start_addr, info->length, - MHP_NONE); + mhp_flags); /* * If the memory block has been used by the kernel, add_memory() -- 2.16.3