diff options
author | Grant Meyerhoff <grant.meyerhoff@ni.com> | 2023-08-24 16:23:09 -0500 |
---|---|---|
committer | Aki Tomita <121511582+atomita-ni@users.noreply.github.com> | 2023-09-06 10:09:36 -0500 |
commit | 5da051fffac04b27b770bac40af3a5690487700c (patch) | |
tree | 89935447dcb2a9c00069d301690e53395f42165f | |
parent | mpmd: allow for mpm device to tell host to reboot mpm (diff) | |
download | uhd-5da051fffac04b27b770bac40af3a5690487700c.tar.xz uhd-5da051fffac04b27b770bac40af3a5690487700c.zip |
x4xx: pass reboot mpm command to host on new clock config for x440
-rw-r--r-- | host/docs/usrp_x4xx.dox | 1 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/x4xx.py | 1 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/x4xx_clock_mgr.py | 34 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/x4xx_clock_policy.py | 12 |
4 files changed, 47 insertions, 1 deletions
diff --git a/host/docs/usrp_x4xx.dox b/host/docs/usrp_x4xx.dox index 717a83ba8..4417711d8 100644 --- a/host/docs/usrp_x4xx.dox +++ b/host/docs/usrp_x4xx.dox @@ -945,6 +945,7 @@ For a list of which arguments can be passed into make(), see Section cal_delay | Delay for calibration threshold status (see \ref x4xx_adc_self_cal). | cal_delay=100 cal_ch_list | Selects the channels to be calibrated. | cal_ch_list=1;2;3 skip_adc_selfcal | Skips the ADC self-cal on clock-reconfig. | skip_adc_selfcal=true + skip_mpm_reboot | Skips MPM rebooting during session initialization on clock-reconfig. X440 only. | skip_mpm_reboot=1 \subsection x4xx_usage_mcrs Master Clock Rates diff --git a/mpm/python/usrp_mpm/periph_manager/x4xx.py b/mpm/python/usrp_mpm/periph_manager/x4xx.py index 8060522b4..d8f84a1fa 100644 --- a/mpm/python/usrp_mpm/periph_manager/x4xx.py +++ b/mpm/python/usrp_mpm/periph_manager/x4xx.py @@ -296,6 +296,7 @@ class x4xx(ZynqComponents, PeriphManagerBase): return try: if not args.get('skip_boot_init', False): + args['boot_init'] = True self.init(args) except Exception as ex: self.log.warning("Failed to initialize device on boot: %s", str(ex)) diff --git a/mpm/python/usrp_mpm/periph_manager/x4xx_clock_mgr.py b/mpm/python/usrp_mpm/periph_manager/x4xx_clock_mgr.py index 8d3561a3b..f115c2844 100644 --- a/mpm/python/usrp_mpm/periph_manager/x4xx_clock_mgr.py +++ b/mpm/python/usrp_mpm/periph_manager/x4xx_clock_mgr.py @@ -41,7 +41,7 @@ For a block diagram, cf. usrp_x4xx.dox. For more details, see the schematic. """ from enum import Enum -from usrp_mpm.mpmutils import parse_multi_device_arg +from usrp_mpm.mpmutils import parse_multi_device_arg, str2bool from usrp_mpm.periph_manager.x4xx_clk_aux import ClockingAuxBrdControl from usrp_mpm.periph_manager.x4xx_clock_types import RpllRefSel, BrcSource from usrp_mpm.periph_manager.x4xx_clock_ctrl import X4xxClockCtrl @@ -135,11 +135,13 @@ class X4xxClockManager: self._safe_sync_source = { 'clock_source': self.X400_DEFAULT_CLOCK_SOURCE, 'time_source': self.X400_DEFAULT_TIME_SOURCE, + 'skip_mpm_reboot': 1, } else: self._safe_sync_source = { 'clock_source': self.CLOCK_SOURCE_MBOARD, 'time_source': self.TIME_SOURCE_INTERNAL, + 'skip_mpm_reboot': 1, } self.clk_policy = clk_policy # Parse args @@ -187,6 +189,8 @@ class X4xxClockManager: self.clk_ctrl = X4xxClockCtrl(cpld_control, log) self._init_ref_clock_and_time() self._init_meas_clock() + self.configured_since_boot = False + self.tasks["mpm_reboot"] = [] ### IMPORTANT! The clocking initialization is not complete until ### finalize_init() was called. This is as far as we get for now. @@ -332,6 +336,7 @@ class X4xxClockManager: args['clock_source'] = args.get('clock_source', self.X400_DEFAULT_CLOCK_SOURCE) args['time_source'] = args.get('time_source', self.X400_DEFAULT_TIME_SOURCE) self.clk_policy.args = args + args['initializing'] = True # This flag is used to skip the self-cal that otherwise is marked as required # after each clocking change self.skip_adc_selfcal = args.get('skip_adc_selfcal', False) @@ -385,6 +390,8 @@ class X4xxClockManager: if force_set_mcr: args['force_reinit'] = True self.set_sync_source(args) + if not 'boot_init' in args: + self.configured_since_boot = True @no_rpc @@ -921,6 +928,31 @@ class X4xxClockManager: self.log.debug("Skipping reconfiguration of clocks.") return try: + # An intermittent spur has been seen on multiple reconfigurations of clocking for x440. + # If we have already reconfigured clocking after initializtion, the next clocking + # reconfiguration will trigger MPM to reboot + skip_mpm_reboot = str2bool(args.get('skip_mpm_reboot', False)) + initializing = str2bool(args.get('initializing', False)) + if self.clk_policy.should_reboot_on_reconfiguration() \ + and self.configured_since_boot \ + and not skip_mpm_reboot: + if initializing: + self.tasks["mpm_reboot"] = [{"Run":"True"}] + # We are going to reboot mpm, so return early + return + else: + # If a different clocking configuration is being set through an + # API after device initialization (e.g. set_clock_source()), then + # don't return and reboot mpm, throw an error that reconfiguring + # the clocking configuration can lead to bad performance + raise RuntimeError("Changing clocking configuration after device " + "initialization is not permitted since it can " + "lead to decreased spurious performance. " + "To configure clocking settings, use the proper " + "device arguments during initialization") + if skip_mpm_reboot: + self.log.warning("Overriding recommended MPM reboot during clocking configuration. " + "This can lead to decreased spurious performance") self.log.debug( f"Reconfiguring clock configuration for a master clock rate of " f"{master_clock_rates}") diff --git a/mpm/python/usrp_mpm/periph_manager/x4xx_clock_policy.py b/mpm/python/usrp_mpm/periph_manager/x4xx_clock_policy.py index f7777b7e3..be0d1a3cc 100644 --- a/mpm/python/usrp_mpm/periph_manager/x4xx_clock_policy.py +++ b/mpm/python/usrp_mpm/periph_manager/x4xx_clock_policy.py @@ -179,6 +179,12 @@ class X4xxClockPolicy: """ raise NotImplementedError() + def should_reboot_on_reconfiguration(self): + """ + This returns if MPM should reboot on a clocking reconfiguration + """ + raise NotImplementedError() + class X410ClockPolicy(X4xxClockPolicy): """ This is a pretty dumb policy, everything is hardcoded. @@ -344,6 +350,9 @@ class X410ClockPolicy(X4xxClockPolicy): mmcm_use_defaults=True ) + def should_reboot_on_reconfiguration(self): + return False + class X440ClockPolicy(X4xxClockPolicy): """ This is the clocking policy for X440. In contrast to the @@ -766,6 +775,9 @@ class X440ClockPolicy(X4xxClockPolicy): return X4xxClockConfig(**clk_config) + def should_reboot_on_reconfiguration(self): + return True + def get_clock_policy(mboard_info, dboard_infos, args, log): """ Return a clocking policy object based on the available hardware. |