From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 28711C761A6 for ; Mon, 20 Mar 2023 07:38:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 91BF685A5F; Mon, 20 Mar 2023 08:38:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="clYujfYO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 416C085A48; Mon, 20 Mar 2023 08:38:43 +0100 (CET) Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 522CE85AB9 for ; Mon, 20 Mar 2023 08:38:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ed1-x52e.google.com with SMTP id ek18so42945649edb.6 for ; Mon, 20 Mar 2023 00:38:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679297920; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=QfyCXwHBiUYMWgf1+qpdhBumbeFOt+c7/gtIN98gmd0=; b=clYujfYOTR0I0q91MNVmKeQ+W8RF5hhz7yxmbQKPPzLsgBZWK4yOd7QRLHIa7ukcdw aX9zA5gISjWf4Onl4v79Rx+rtZfF4xqrFcjvFXWbCZpzV9e/pLuS21wnMDekvyojeqqE 0eJuuGwjihG7u+1z8imMxDGdbEncyFg3WPEGIBCUUl1yseQFnPxU/gBd4t9YNZi53EZ1 HOx4ARLvp0AoIB8km+F+crs7amEyzT8E0XDCbkLVfuD108FFzl0jJ0SdX1a8xtNqRhUf YK8CgOi7lvpd01Bp00GaNlpXNaIhwhEr2D66QmOYh+vIsvKz79jATqEQwjH5DpDWxQRE Ba6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679297920; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QfyCXwHBiUYMWgf1+qpdhBumbeFOt+c7/gtIN98gmd0=; b=ooSfX1MWc0lPHq4HJsCqi5lhJofiyL4cM9evTf7lScao3ieRjqxnuUktXJvBaz8Uos gEDnxuh3ici099h+hWqjboS+D45CzTivTDRhlFOZ+BbNqgGntMKehRnYuHub+yMlf/68 ICz0IlltriAnQD7/UeHKqehGy6Oj4W3KaGe0TatH5Ciqw3Qpakm1yPliF2lH1SXDyOZ0 +Cxk4Xdb0ua13xrCWI8SeISeFkwNNBydCejlDcemEn00WaqR+XTY/8mOzHM3B69wG7B1 5GDHRMtmxZOjHmtM4Zwul16BQ2AUxozJC00buAVd7H74yniZ0AHtW0/9g2QWH0wRwCJt pYlQ== X-Gm-Message-State: AO0yUKXZ7T/MO2bQDSkharzbTtqpW5PgJXvYt6sS/Lz5T4ohOG0RNlxX DVI0JhhAVDfDwdpcE+kQIr3mkIZ1wO412eyFnJA= X-Google-Smtp-Source: AK7set8oLZ2vqIn/oaTMrxAHST08x2PAb+4k6iPEYd84W5hnKI0mGJ/ltxdLymx4hiKCsXfIdcXXXg== X-Received: by 2002:aa7:de94:0:b0:501:c547:2135 with SMTP id j20-20020aa7de94000000b00501c5472135mr2622833edv.36.1679297919825; Mon, 20 Mar 2023 00:38:39 -0700 (PDT) Received: from hera (ppp176092130041.access.hol.gr. [176.92.130.41]) by smtp.gmail.com with ESMTPSA id u22-20020a50d516000000b004ad601533a3sm4486727edi.55.2023.03.20.00.38.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 00:38:39 -0700 (PDT) Date: Mon, 20 Mar 2023 09:38:37 +0200 From: Ilias Apalodimas To: Heinrich Schuchardt Cc: u-boot@lists.denx.de Subject: Re: [PATCH 1/2] efi_loader: move dp_alloc() to efi_alloc() Message-ID: References: <20230319082023.97558-1-heinrich.schuchardt@canonical.com> <20230319082023.97558-2-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230319082023.97558-2-heinrich.schuchardt@canonical.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Hi Heinrich, On Sun, Mar 19, 2023 at 09:20:22AM +0100, Heinrich Schuchardt wrote: > The incumbent function efi_alloc() is unused. > > Replace dp_alloc() by a new function efi_alloc() that we can use more > widely. [...] > #include > #include > +#include > #include > #include > #include > @@ -533,27 +536,6 @@ efi_status_t efi_allocate_pages(enum efi_allocate_type type, > return EFI_SUCCESS; > } > > -/** > - * efi_alloc() - allocate memory pages > - * > - * @len: size of the memory to be allocated > - * @memory_type: usage type of the allocated memory > - * Return: pointer to the allocated memory area or NULL > - */ > -void *efi_alloc(uint64_t len, int memory_type) > -{ > - uint64_t ret = 0; > - uint64_t pages = efi_size_in_pages(len); > - efi_status_t r; > - > - r = efi_allocate_pages(EFI_ALLOCATE_ANY_PAGES, memory_type, pages, > - &ret); > - if (r == EFI_SUCCESS) > - return (void*)(uintptr_t)ret; > - > - return NULL; > -} > - > /** > * efi_free_pages() - free memory pages > * > @@ -672,6 +654,28 @@ efi_status_t efi_allocate_pool(enum efi_memory_type pool_type, efi_uintn_t size, > return r; > } > > +/** > + * efi_alloc() - allocate boot services data pool memory > + * > + * Allocate memory from pool and zero it out. > + * > + * @size: number of bytes to allocate > + * Return: pointer to allocated memory or NULL > + */ > +void *efi_alloc(size_t size) All our allocation related functions require the memory type to be passed. If we want to default this to 'EFI_BOOT_SERVICES_DATA' I think we need to change the name a bit to indicate that. > +{ > + void *buf; > + > + if (efi_allocate_pool(EFI_BOOT_SERVICES_DATA, size, &buf) != Is there a reason we are using efi_allocate_pool instead of efi_allocate_pages? > + EFI_SUCCESS) { > + log_err("out of memory"); > + return NULL; > + } > + memset(buf, 0, size); > + > + return buf; > +} > + > /** > * efi_free_pool() - free memory from pool > * > -- > 2.39.2 > Thanks /Ilias