Page MenuHomeFreeBSD

xen: Code cleanup and small bug fixes
ClosedPublic

Authored by julien.grall_citrix.com on Oct 16 2015, 5:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 16 2024, 8:10 AM
Unknown Object (File)
Feb 16 2024, 6:32 AM
Unknown Object (File)
Feb 16 2024, 5:30 AM
Unknown Object (File)
Feb 1 2024, 8:08 PM
Unknown Object (File)
Dec 20 2023, 1:13 AM
Unknown Object (File)
Nov 28 2023, 1:05 PM
Unknown Object (File)
Nov 17 2023, 7:59 PM
Unknown Object (File)
Nov 15 2023, 12:12 PM
Subscribers

Details

Reviewers
royger
Summary
  • sys/xen/hypervisor.h:
    • Remove unused helpers: MULTI_update_va_mapping, is_initial_xendomain,

is_running_on_xen

  • Remove unused define CONFIG_X86_PAE
  • Remove unused variable xen_start_info: note that it's used in

pcifront which is not built at all

  • Remove forward declaration of HYPERVISOR_crash
  • xen-os.h:
    • Remove unused define CONFIG_X86_PAE
    • Drop unused helpers: test_and_clear_bit, clear_bit, force_evtchn_callback
    • Implement a generic version (based on ofed/include/linux/bitops.h)

of set_bit and test_bit and prefix them by xen_ to avoid any use by
other code than Xen. Note that It would be worth to investigate a
generic implementation in FreeBSD.

  • Replace barrier() by __compiler_membar()
  • Replace cpu_relax() by cpu_spinwait(): it's exactly the same as

rep;nop = pause

  • xen/xen_intr.h:
    • Move the prototype of xen_intr_handle_upcall in it: Use by all the

platform

  • x86/xen/xen_intr.c:
    • Use BITSET* for the enabledbits: Avoid to use custom helpers
    • test_bit/set_bit has been renamed to xen_test_bit/xen_set_bit
    • Don't export the variable xen_intr_pcpu
  • dev/xen/blkback/blkback.c:
    • Fix the string format when XBB_DEBUG is enabled: host_addr

is typed uint64_t

  • dev/xen/balloon/balloon.c:
      • Remove set but not used variable
    • Use the correct type for frame_list: xen_pfn_t represents the frame

number on any architecture

  • dev/xen/control/control.c:
    • Return BUS_PROBE_WILDCARD in xs_probe: Returning 0 in a probe

callback means the driver can handle this device. If by any chance
xenstore is the first driver, every new device with the driver is
unset will use xenstore.

  • dev/xen/grant-table/grant_table.c:
      • Remove unused cmpxchg
    • Drop unused include opt_pmap.h: Doesn't exist on ARM64 and it

doesn't contain anything required for the code on x86

  • dev/xen/netfront/netfront.c:
    • Use the correct type for rx_pfn_array: xen_pfn_t represents the

frame number on any architecture

  • dev/xen/netback/netback.c:
    • Use the correct type for gmfn: xen_pfn_t represents the frame

number on any architecture

  • dev/xen/xenstore/xenstore.c:
    • Return BUS_PROBE_WILDCARD in xctrl_probe: Returning 0 in a probe

callback means the driver can handle this device. If by any chance
xenstore is the first driver, every new device with the driver is
unset will use xenstore.

Note that with the changes, x86/include/xen/xen-os.h doesn't contain anymore
arch-specific code. Although, a new series will add some helpers that differ
between x86 and ARM64, so I've kept the headers for now.

Test Plan

Only build tested on amd64/i386. Tested with arm64.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 786
Build 786: arc lint + arc unit

Event Timeline

julien.grall_citrix.com retitled this revision from to xen: Code cleanup and small bug fixes.
julien.grall_citrix.com updated this object.
julien.grall_citrix.com edited the test plan for this revision. (Show Details)
julien.grall_citrix.com added a reviewer: royger.
royger edited edge metadata.

LGTM

sys/x86/xen/xen_intr.c
504

I don't like accessing __bits directly, but I cannot find a macro or function to get this. Also all the BIT_* macros access __bits directly, so I guess it's fine :/.

This revision is now accepted and ready to land.Oct 20 2015, 1:39 PM