From: Bjorn Helgaas <helgaas@kernel.org> To: nirmoy.das@amd.com, bhelgaas@google.com, ckoenig.leichtzumerken@gmail.com, linux-pci@vger.kernel.org, christian.koenig@amd.com, devspam@moreofthesa.me.uk, dri-devel@lists.freedesktop.org Subject: Re: [PATCH 2/4] PCI: Add pci_rebar_bytes_to_size() Date: Thu, 7 Jan 2021 19:01:47 -0600 [thread overview] Message-ID: <20210108010147.GA1406822@bjorn-Precision-5520> (raw) In-Reply-To: <58F0BFBCD0%devspam@moreofthesa.me.uk> On Thu, Jan 07, 2021 at 11:31:36PM +0000, Darren Salt wrote: > I demand that Bjorn Helgaas may or may not have written... ? > >> +static inline int pci_rebar_bytes_to_size(u64 bytes) > >> +{ > >> + bytes = roundup_pow_of_two(bytes); > >> + return max(ilog2(bytes), 20) - 20; > > > This isn't returning a "size", is it? It looks like it's returning the > > log2 of the number of MB the BAR will be, i.e., the encoding used by the > > Resizable BAR Control register "BAR Size" field. Needs a brief comment to > > that effect and/or a different function name. > > Given that, it seems to me that pci_rebar_size_to_bytes should be similarly > commented and/or renamed. Makes sense. Something like this is sufficient: return 1ULL << (size + 20); /* Convert PCI_REBAR_CTRL "BAR Size" */
WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Helgaas <helgaas@kernel.org> To: nirmoy.das@amd.com, bhelgaas@google.com, ckoenig.leichtzumerken@gmail.com, linux-pci@vger.kernel.org, christian.koenig@amd.com, devspam@moreofthesa.me.uk, dri-devel@lists.freedesktop.org Subject: Re: [PATCH 2/4] PCI: Add pci_rebar_bytes_to_size() Date: Thu, 7 Jan 2021 19:01:47 -0600 [thread overview] Message-ID: <20210108010147.GA1406822@bjorn-Precision-5520> (raw) In-Reply-To: <58F0BFBCD0%devspam@moreofthesa.me.uk> On Thu, Jan 07, 2021 at 11:31:36PM +0000, Darren Salt wrote: > I demand that Bjorn Helgaas may or may not have written... ? > >> +static inline int pci_rebar_bytes_to_size(u64 bytes) > >> +{ > >> + bytes = roundup_pow_of_two(bytes); > >> + return max(ilog2(bytes), 20) - 20; > > > This isn't returning a "size", is it? It looks like it's returning the > > log2 of the number of MB the BAR will be, i.e., the encoding used by the > > Resizable BAR Control register "BAR Size" field. Needs a brief comment to > > that effect and/or a different function name. > > Given that, it seems to me that pci_rebar_size_to_bytes should be similarly > commented and/or renamed. Makes sense. Something like this is sufficient: return 1ULL << (size + 20); /* Convert PCI_REBAR_CTRL "BAR Size" */ _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2021-01-08 1:02 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-07 17:50 [PATCH 0/4] A PCI quirk for resizable BAR 0 on Navi10 Nirmoy Das 2021-01-07 17:50 ` Nirmoy Das 2021-01-07 17:50 ` [PATCH 1/4] PCI: Export pci_rebar_get_possible_sizes() Nirmoy Das 2021-01-07 17:50 ` Nirmoy Das 2021-01-07 21:18 ` Bjorn Helgaas 2021-01-07 21:18 ` Bjorn Helgaas 2021-01-07 17:50 ` [PATCH 2/4] PCI: Add pci_rebar_bytes_to_size() Nirmoy Das 2021-01-07 17:50 ` Nirmoy Das 2021-01-07 21:17 ` Bjorn Helgaas 2021-01-07 21:17 ` Bjorn Helgaas 2021-01-07 23:31 ` Darren Salt 2021-01-07 23:31 ` Darren Salt 2021-01-08 1:01 ` Bjorn Helgaas [this message] 2021-01-08 1:01 ` Bjorn Helgaas 2021-01-07 17:50 ` [PATCH 3/4] drm/amdgpu: Resize BAR0 to the maximum available size, even if it doesn't cover VRAM Nirmoy Das 2021-01-07 17:50 ` Nirmoy Das 2021-01-07 17:50 ` [PATCH 4/4] PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse Nirmoy Das 2021-01-07 17:50 ` Nirmoy Das 2021-01-07 21:32 ` Bjorn Helgaas 2021-01-07 21:32 ` Bjorn Helgaas 2021-01-07 20:25 ` Christian König 2021-01-07 20:25 ` Christian König
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210108010147.GA1406822@bjorn-Precision-5520 \ --to=helgaas@kernel.org \ --cc=bhelgaas@google.com \ --cc=christian.koenig@amd.com \ --cc=ckoenig.leichtzumerken@gmail.com \ --cc=devspam@moreofthesa.me.uk \ --cc=dri-devel@lists.freedesktop.org \ --cc=linux-pci@vger.kernel.org \ --cc=nirmoy.das@amd.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.