qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 9c4a5c: fw_cfg: move internal function call d


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 9c4a5c: fw_cfg: move internal function call docs to header...
Date: Thu, 17 Dec 2015 06:00:06 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 9c4a5c55f5c6c63c24c29e5a3b57ddbc1e550303
      
https://github.com/qemu/qemu/commit/9c4a5c55f5c6c63c24c29e5a3b57ddbc1e550303
  Author: Gabriel L. Somlo <address@hidden>
  Date:   2015-12-15 (Tue, 15 Dec 2015)

  Changed paths:
    M docs/specs/fw_cfg.txt
    M include/hw/nvram/fw_cfg.h

  Log Message:
  -----------
  fw_cfg: move internal function call docs to header file

Move documentation for fw_cfg functions internal to qemufrom
docs/specs/fw_cfg.txt to the fw_cfg.h header file, next to
their prototype declarations, formatted as doc-comments.

NOTE: Documentation for fw_cfg_add_callback() is completely
dropped by this patch, as that function has been eliminated
by commit 023e3148.

Suggested-by: Peter Maydell <address@hidden>
Cc: Laszlo Ersek <address@hidden>
Cc: Gerd Hoffmann <address@hidden>
Cc: Marc Marí <address@hidden>
Cc: Jordan Justen <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Peter Maydell <address@hidden>
Signed-off-by: Gabriel Somlo <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 3bef7e8aab8af2f86c5785761c37e068428c689d
      
https://github.com/qemu/qemu/commit/3bef7e8aab8af2f86c5785761c37e068428c689d
  Author: Gabriel L. Somlo <address@hidden>
  Date:   2015-12-15 (Tue, 15 Dec 2015)

  Changed paths:
    M hw/nvram/fw_cfg.c
    M include/hw/nvram/fw_cfg.h

  Log Message:
  -----------
  fw_cfg: amend callback behavior spec to once per select

Currently, the fw_cfg internal API specifies that if an item was set up
with a read callback, the callback must be run each time a byte is read
from the item. This behavior is both wasteful (most items do not have a
read callback set), and impractical for bulk transfers (e.g., DMA read).

At the time of this writing, the only items configured with a callback
are "/etc/table-loader", "/etc/acpi/tables", and "/etc/acpi/rsdp". They
all share the same callback functions: virt_acpi_build_update() on ARM
(in hw/arm/virt-acpi-build.c), and acpi_build_update() on i386 (in
hw/i386/acpi.c). Both of these callbacks are one-shot (i.e. they return
without doing anything at all after the first time they are invoked with
a given build_state; since build_state is also shared across all three
items mentioned above, the callback only ever runs *once*, the first
time either of the listed items is read).

This patch amends the specification for fw_cfg_add_file_callback() to
state that any available read callback will only be invoked once each
time the item is selected. This change has no practical effect on the
current behavior of QEMU, and it enables us to significantly optimize
the behavior of fw_cfg reads during guest firmware setup, eliminating
a large amount of redundant callback checks and invocations.

Cc: Laszlo Ersek <address@hidden>
Cc: Gerd Hoffmann <address@hidden>
Cc: Marc Marí <address@hidden>
Signed-off-by: Gabriel Somlo <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 3f8752b4e5a3871f0d2963ab889be937d9a4226a
      
https://github.com/qemu/qemu/commit/3f8752b4e5a3871f0d2963ab889be937d9a4226a
  Author: Gabriel L. Somlo <address@hidden>
  Date:   2015-12-15 (Tue, 15 Dec 2015)

  Changed paths:
    M hw/arm/virt-acpi-build.c
    M hw/i386/acpi-build.c
    M hw/nvram/fw_cfg.c
    M include/hw/nvram/fw_cfg.h

  Log Message:
  -----------
  fw_cfg: remove offset argument from callback prototype

Read callbacks are now only invoked at item selection, before any
data is read. As such, the value of the offset argument passed to
the callback will always be 0. Also, the two callback instances
currently in use both leave their offset argument unused.

This patch removes the offset argument from the fw_cfg read callback
prototype, and from the currently available instances. The unused
(write) callback prototype is also removed (write support was removed
earlier, in commit 023e3148).

Cc: Laszlo Ersek <address@hidden>
Cc: Gerd Hoffmann <address@hidden>
Cc: Marc Marí <address@hidden>
Signed-off-by: Gabriel Somlo <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 66f8fd9dda312191b78d2a2ba2848bcee76127a2
      
https://github.com/qemu/qemu/commit/66f8fd9dda312191b78d2a2ba2848bcee76127a2
  Author: Gabriel L. Somlo <address@hidden>
  Date:   2015-12-15 (Tue, 15 Dec 2015)

  Changed paths:
    M hw/nvram/fw_cfg.c

  Log Message:
  -----------
  fw_cfg: avoid calculating invalid current entry pointer

When calculating a pointer to the currently selected fw_cfg item, the
following is used:

  FWCfgEntry *e = &s->entries[arch][s->cur_entry & FW_CFG_ENTRY_MASK];

When s->cur_entry is FW_CFG_INVALID, we are calculating the address of
a non-existent element in s->entries[arch][...], which is undefined.

This patch ensures the resulting entry pointer is set to NULL whenever
s->cur_entry is FW_CFG_INVALID.

Reported-by: Laszlo Ersek <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Signed-off-by: Gabriel Somlo <address@hidden>
Message-id: address@hidden
Cc: Marc Marí <address@hidden>
Signed-off-by: Gabriel Somlo <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 38bf20931afe761fccda6e1eb91d64c7498ed9c9
      
https://github.com/qemu/qemu/commit/38bf20931afe761fccda6e1eb91d64c7498ed9c9
  Author: Gabriel L. Somlo <address@hidden>
  Date:   2015-12-15 (Tue, 15 Dec 2015)

  Changed paths:
    M hw/nvram/fw_cfg.c
    M trace-events

  Log Message:
  -----------
  fw_cfg: add generic non-DMA read method

Introduce fw_cfg_data_read(), a generic read method which works
on all access widths (1 through 8 bytes, inclusive), and can be
used during both IOPort and MMIO read accesses.

To maintain legibility, only fw_cfg_data_mem_read() (the MMIO
data read method) is replaced by this patch. The new method
essentially unwinds the fw_cfg_data_mem_read() + fw_cfg_read()
combo, but without unnecessarily repeating all the validity
checks performed by the latter on each byte being read.

This patch also modifies the trace_fw_cfg_read prototype to
accept a 64-bit value argument, allowing it to work properly
with the new read method, but also remain backward compatible
with existing call sites.

Cc: Laszlo Ersek <address@hidden>
Cc: Gerd Hoffmann <address@hidden>
Cc: Marc Marí <address@hidden>
Signed-off-by: Gabriel Somlo <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 6c8d56a2e95712a6206a2671d2b04b2e59cabc0b
      
https://github.com/qemu/qemu/commit/6c8d56a2e95712a6206a2671d2b04b2e59cabc0b
  Author: Gabriel L. Somlo <address@hidden>
  Date:   2015-12-15 (Tue, 15 Dec 2015)

  Changed paths:
    M hw/nvram/fw_cfg.c

  Log Message:
  -----------
  fw_cfg: replace ioport data read with generic method

IOPort read access is limited to one byte at a time by
fw_cfg_comb_valid(). As such, fw_cfg_comb_read() may safely
ignore its size argument (which will always be 1), and simply
call its fw_cfg_read() helper function once, returning 8 bits
via the least significant byte of a 64-bit return value.

This patch replaces fw_cfg_comb_read() with the generic method
fw_cfg_data_read(), and removes the unused fw_cfg_read() helper.

When called with size = 1, fw_cfg_data_read() acts exactly like
fw_cfg_read(), performing the same set of sanity checks, and
executing the while loop at most once (subject to the current
read offset being within range).

Cc: Laszlo Ersek <address@hidden>
Cc: Gerd Hoffmann <address@hidden>
Cc: Marc Marí <address@hidden>
Signed-off-by: Gabriel Somlo <address@hidden>
Message-id: address@hidden
Reviewed-by: Laszlo Ersek <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 98557acf92977b6ecf98b4f7183a518cc47d21cc
      
https://github.com/qemu/qemu/commit/98557acf92977b6ecf98b4f7183a518cc47d21cc
  Author: Peter Maydell <address@hidden>
  Date:   2015-12-17 (Thu, 17 Dec 2015)

  Changed paths:
    M docs/specs/fw_cfg.txt
    M hw/arm/virt-acpi-build.c
    M hw/i386/acpi-build.c
    M hw/nvram/fw_cfg.c
    M include/hw/nvram/fw_cfg.h
    M trace-events

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/kraxel/tags/pull-fw-cfg-20151217-1' 
into staging

fw_cfg: doc updates, various optimizations.

# gpg: Signature made Thu 17 Dec 2015 08:59:32 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <address@hidden>"
# gpg:                 aka "Gerd Hoffmann <address@hidden>"
# gpg:                 aka "Gerd Hoffmann (private) <address@hidden>"

* remotes/kraxel/tags/pull-fw-cfg-20151217-1:
  fw_cfg: replace ioport data read with generic method
  fw_cfg: add generic non-DMA read method
  fw_cfg: avoid calculating invalid current entry pointer
  fw_cfg: remove offset argument from callback prototype
  fw_cfg: amend callback behavior spec to once per select
  fw_cfg: move internal function call docs to header file

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/c1a5f950cdee...98557acf9297

reply via email to

[Prev in Thread] Current Thread [Next in Thread]