From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7CE8321A16EFF for ; Thu, 18 May 2017 15:13:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EA6173B46B; Thu, 18 May 2017 22:13:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EA6173B46B Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com EA6173B46B Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-86.phx2.redhat.com [10.3.116.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 261D460BE1; Thu, 18 May 2017 22:13:01 +0000 (UTC) From: Laszlo Ersek To: Jordan Justen , edk2-devel-01 References: <20170518151436.16566-1-lersek@redhat.com> <20170518151436.16566-3-lersek@redhat.com> <149513337025.15724.8536347902397365487@jljusten-skl.jf.intel.com> <8b42c90a-31fb-d1c5-307c-5bc78760660a@redhat.com> <149514098528.16116.10665105642348221621@jljusten-skl.jf.intel.com> <71240da1-43bc-3741-dfbc-7f0b13c9b6e7@redhat.com> Message-ID: <8bb9e39a-f8ac-0416-0ea9-6c1ef7df3e98@redhat.com> Date: Fri, 19 May 2017 00:13:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <71240da1-43bc-3741-dfbc-7f0b13c9b6e7@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 18 May 2017 22:13:03 +0000 (UTC) Subject: Re: [PATCH v2 2/5] OvmfPkg/EmuVariableFvbRuntimeDxe: change block size to 4KB X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 May 2017 22:13:03 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 05/18/17 23:09, Laszlo Ersek wrote: > On 05/18/17 22:56, Jordan Justen wrote: >> On 2017-05-18 12:40:30, Laszlo Ersek wrote: >>> On 05/18/17 20:49, Jordan Justen wrote: >>>> On 2017-05-18 08:14:33, Laszlo Ersek wrote: >>>>> diff --git a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.h b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.h >>>>> index 4247d21d72f8..beb11e3f9a90 100644 >>>>> --- a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.h >>>>> +++ b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.h >>>>> @@ -58,8 +58,14 @@ typedef struct { >>>>> // >>>>> // Constants >>>>> // >>>>> -#define EMU_FVB_BLOCK_SIZE (FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize)) >>>>> -#define EMU_FVB_SIZE (2 * FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize)) >>>>> +#define EMU_FVB_BLOCK_SIZE \ >>>>> + EFI_PAGE_SIZE >>>>> +#define EMU_FVB_NUM_SPARE_BLOCKS \ >>>>> + EFI_SIZE_TO_PAGES ((UINTN)FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize)) >>>>> +#define EMU_FVB_NUM_TOTAL_BLOCKS \ >>>>> + (2 * EMU_FVB_NUM_SPARE_BLOCKS) >>>>> +#define EMU_FVB_SIZE \ >>>>> + (EMU_FVB_NUM_TOTAL_BLOCKS * EMU_FVB_BLOCK_SIZE) >>>>> #define FTW_WRITE_QUEUE_SIZE \ >>>>> (FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) - \ >>>>> sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER)) >>>> >>>> In the cases where we don't exceed 80 columns, I don't see the excess >>>> newlines as helping here, style-wise. >>> >>> My first preference would have been >>> >>> #define SHORT_MACRO_NAME replacement text 1 >>> #define ANNOYINGLY_LONG_MACRO_NAME replacement text 2 >>> >>> That is, to keep both the macro names and the replacement texts aligned. >>> However, that way I wouldn't fit into 80 chars on some lines, and then >>> breaking only *some* macro definitions to multiple lines looked >>> horrible. Which is why I opted for the current layout: it is uniform, >>> and it does preserve the alignment for both macro names and replacement >>> texts separately. >> >> I don't think you would make a block of function calls all multiline >> if one call required it. I see your point and I agree that aligning >> things can be nice if it works out. It seems like it doesn't in this >> case. >> >> Could FTW_SPARE_SIZE and FTW_WORKING_SIZE macros help? > > Assuming you mean those as shorthands for the FixedPcdGet32() macro > invocations, they wouldn't (fully); FTW_WRITE_QUEUE_SIZE would remain > overlong even after such a replacement. > >> >> If you feel strongly about this current format, then keep it, as I >> don't feel too strongly about it. > > I don't feel strongly about this layout, so if (when) you have an > incremental patch, I'll be glad to review it. What I do feel strongly > about :) is not wanting to retest the -bios scenarios, which is sort of > required once these macros are touched. (The ASSERT() below is a lot > easier / quicker to test.) Due to the testing impact, I prefer to keep > the current layout. > >> >>>> >>>> Could you add to the entry-point an assert: >>>> >>>> ASSERT(FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) % >>>> EMU_FVB_BLOCK_SIZE == 0); >>> >>> Should I squash that into this patch? >> >> Yeah. No need for resend. > > Thanks, I'll squash it then. Commit 7e8329267ecb.